<string> Support

Construction from std::string and std::string_view

Each of the decimal types have constructors that look like the following

namespace boost {
namespace decimal {

class decimal32_t
{

    constexpr decimal32_t(const char* str)

    #ifndef BOOST_DECIMAL_HAS_STD_STRING_VIEW
    inline decimal32_t::decimal32_t(const std::string& str);
    #else
    constexpr decimal32_t::decimal32_t(std::string_view str);
    #endif
};

} // namespace decimal
} // namespace boost

These constructors allow for construction from C-strings, std::string, and from std::string_view when available. They construct the value as though calling from_chars without a specified format. If the input string is invalid these constructors will throw std::runtime_error. If you are using a no exceptions environment instead of throwing the constructor will return a Quiet NAN.

to_string

#include <boost/decimal/string.hpp>

namespace boost {
namespace decimal {

template <typename DecimalType>
std::string to_string(const DecimalType value)

} // namespace decimal
} // namespace boost

The to_string format returns a std::string of the decimal value formated as though using to_chars with general formatting, and no specified precision.