File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ class decimal32_fast final
7171 template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
7272 friend constexpr auto frexp10 (T num, int * expptr) noexcept -> typename T::significand_type;
7373
74+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE TargetType, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal>
75+ friend constexpr auto to_decimal (Decimal val) noexcept -> TargetType;
76+
7477public:
7578 constexpr decimal32_fast () noexcept : significand_{}, exponent_{}, sign_ {} {}
7679
@@ -143,6 +146,9 @@ class decimal32_fast final
143146 explicit constexpr operator detail::uint128_t () const noexcept ;
144147 #endif
145148
149+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, std::enable_if_t <detail::is_decimal_floating_point_v<Decimal>, bool > = true >
150+ explicit constexpr operator Decimal () const noexcept ;
151+
146152 friend constexpr auto direct_init (std::uint_fast32_t significand, std::uint_fast8_t exponent, bool sign) noexcept -> decimal32_fast;
147153};
148154
@@ -644,6 +650,12 @@ constexpr decimal32_fast::operator detail::uint128_t() const noexcept
644650
645651#endif
646652
653+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, std::enable_if_t <detail::is_decimal_floating_point_v<Decimal>, bool >>
654+ constexpr decimal32_fast::operator Decimal () const noexcept
655+ {
656+ return to_decimal<Decimal>(*this );
657+ }
658+
647659} // namespace decimal
648660} // namespace boost
649661
You can’t perform that action at this time.
0 commit comments