@@ -819,47 +819,6 @@ constexpr decimal32_t::decimal32_t(const T1 coeff, const T2 exp) noexcept : deci
819819
820820constexpr decimal32_t::decimal32_t (const bool value) noexcept : decimal32_t(static_cast <significand_type>(value), 0, false) {}
821821
822- #if !defined(BOOST_DECIMAL_DISABLE_CLIB)
823-
824- constexpr decimal32_t::decimal32_t (const char * str, const std::size_t len)
825- {
826- if (str == nullptr || len == 0 )
827- {
828- bits_ = detail::d32_nan_mask;
829- BOOST_DECIMAL_THROW_EXCEPTION (std::runtime_error (" Can not construct from invalid string" ));
830- return ; // LCOV_EXCL_LINE
831- }
832-
833- // Normally plus signs aren't allowed
834- auto first {str};
835- if (*first == ' +' )
836- {
837- ++first;
838- }
839-
840- decimal32_t v;
841- const auto r {from_chars (first, str + len, v)};
842- if (r)
843- {
844- *this = v;
845- }
846- else
847- {
848- bits_ = detail::d32_nan_mask;
849- BOOST_DECIMAL_THROW_EXCEPTION (std::runtime_error (" Can not construct from invalid string" ));
850- }
851- }
852-
853- constexpr decimal32_t::decimal32_t (const char * str) : decimal32_t(str, detail::strlen(str)) {}
854-
855- #ifndef BOOST_DECIMAL_HAS_STD_STRING_VIEW
856- inline decimal32_t::decimal32_t (const std::string& str) : decimal32_t(str.c_str(), str.size()) {}
857- #else
858- constexpr decimal32_t::decimal32_t (std::string_view str) : decimal32_t(str.data(), str.size()) {}
859- #endif
860-
861- #endif // BOOST_DECIMAL_DISABLE_CLIB
862-
863822constexpr auto from_bits (const std::uint32_t bits) noexcept -> decimal32_t
864823{
865824 decimal32_t result;
@@ -2389,6 +2348,55 @@ class numeric_limits<boost::decimal::decimal32_t> :
23892348
23902349} // Namespace std
23912350
2351+ // TODO(mborland): Break charconv up since we only need the from_chars implementation here
2352+ // Probably shouldn't be bringing in everything
23922353#include < boost/decimal/charconv.hpp>
23932354
2355+ namespace boost {
2356+ namespace decimal {
2357+
2358+ #if !defined(BOOST_DECIMAL_DISABLE_CLIB)
2359+
2360+ constexpr decimal32_t::decimal32_t (const char * str, const std::size_t len)
2361+ {
2362+ if (str == nullptr || len == 0 )
2363+ {
2364+ bits_ = detail::d32_nan_mask;
2365+ BOOST_DECIMAL_THROW_EXCEPTION (std::runtime_error (" Can not construct from invalid string" ));
2366+ return ; // LCOV_EXCL_LINE
2367+ }
2368+
2369+ // Normally plus signs aren't allowed
2370+ auto first {str};
2371+ if (*first == ' +' )
2372+ {
2373+ ++first;
2374+ }
2375+
2376+ decimal32_t v;
2377+ const auto r {from_chars (first, str + len, v)};
2378+ if (r)
2379+ {
2380+ *this = v;
2381+ }
2382+ else
2383+ {
2384+ bits_ = detail::d32_nan_mask;
2385+ BOOST_DECIMAL_THROW_EXCEPTION (std::runtime_error (" Can not construct from invalid string" ));
2386+ }
2387+ }
2388+
2389+ constexpr decimal32_t::decimal32_t (const char * str) : decimal32_t(str, detail::strlen(str)) {}
2390+
2391+ #ifndef BOOST_DECIMAL_HAS_STD_STRING_VIEW
2392+ inline decimal32_t::decimal32_t (const std::string& str) : decimal32_t(str.c_str(), str.size()) {}
2393+ #else
2394+ constexpr decimal32_t::decimal32_t (std::string_view str) : decimal32_t(str.data(), str.size()) {}
2395+ #endif
2396+
2397+ #endif // BOOST_DECIMAL_DISABLE_CLIB
2398+
2399+ } // namespace decimal
2400+ } // namespace boost
2401+
23942402#endif // BOOST_DECIMAL_decimal32_t_HPP
0 commit comments