<charconv>
The following functions are all overloads injected into Boost.Charconv.
Unlike the rest of the library, using this header depends on the headers of Boost.Charconv being present, otherwise it will #error.
|
to_chars
to_chars is a set of functions that attempts to convert value into a character buffer specified by [first, last).
For full documentation and explanation see the Boost.Charconv documentation.
#include <boost/int128/charconv.hpp>
namespace boost {
namespace charconv {
struct to_chars_result
{
char* ptr;
std::errc ec;
friend constexpr bool operator==(const to_chars_result& lhs, const to_chars_result& rhs) noexcept = default;
constexpr explicit operator bool() const noexcept { return ec == std::errc{}; }
};
BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, int128::uint128_t value, int base = 10) noexcept;
BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, int128::int128_t value, int base = 10) noexcept;
} // namespace charconv
} // namespace boost
BOOST_CHARCONV_CONSTEXPR is defined as constexpr when using a compiler with __builtin_is_constant_evaluated,
or c++20 with std::is_constant_evaluated().
Otherwise, it is defined as inline.
These functions are in the namespace boost::charconv, and not boost::int128
|
from_chars
from_chars is a set of functions that parse a string from [first, last) in an attempt to convert the string into value according to the chars_format specified (if applicable).
For full documentation and explanation see the Boost.Charconv documentation.
#include <boost/int128/charconv.hpp>
namespace boost {
namespace charconv {
struct from_chars_result
{
const char* ptr;
std::errc ec;
friend constexpr bool operator==(const from_chars_result& lhs, const from_chars_result& rhs) noexcept = default;
constexpr explicit operator bool() const noexcept { return ec == std::errc{}; }
};
constexpr from_chars_result from_chars(const char* first, const char* last, int128::uint128_t& value, int base = 10) noexcept;
// Allows both std::string and std::string_view (when available)
constexpr from_chars_result from_chars(core::string_view sv, int128::uint128_t& value, int base = 10) noexcept;
constexpr from_chars_result from_chars(const char* first, const char* last, int128::int128_t& value, int base = 10) noexcept;
// Allows both std::string and std::string_view (when available)
constexpr from_chars_result from_chars(core::string_view sv, int128::int128_t& value, int base = 10) noexcept;
} // namespace charconv
} // namespace boost