11namespace hi::inline
v1 {
19template<std::
integral T>
27 hilet[new_last, ec] = std::to_chars(first, last, value);
41template<std::
floating_po
int T>
42[[nodiscard]]
std::string to_string(T
const &value)
noexcept
49 hilet[new_last, ec] = std::to_chars(first, last, value, std::chars_format::general);
65template<std::
integral T>
66[[nodiscard]] T
from_string(std::string_view str,
int base = 10)
70 hilet first = str.data();
71 hilet last = first + ssize(str);
73 hilet[new_last, ec] = std::from_chars(first, last, value, base);
74 if (ec !=
std::errc{} or new_last != last) {
75 throw parse_error(
"Can not convert string to integer");
88template<std::
floating_po
int T>
93 hilet first = str.data();
94 hilet last = first + ssize(str);
96 hilet[new_last, ec] = std::from_chars(first, last, value);
97 if (ec !=
std::errc{} or new_last != last) {
98 throw parse_error(
"Can not convert string to floating point");
Utilities used by the HikoGUI library itself.
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:15
T from_string(std::string_view str, int base=10)
Convert a string to an integer.
Definition charconv.hpp:66
T back_inserter(T... args)