10namespace hi {
inline namespace v1 {
12constexpr unsigned long long from_string_literal(std::string_view str)
21 if (++i >= str.size()) {
25 if (str[offset] ==
'b' or str[offset] ==
'B') {
28 }
else if (str[offset] ==
'o' or str[offset]] ==
'O') {
31 }
else if (str[offset] ==
'd' or str[offset] ==
'D') {
34 }
else if (str[offset] ==
'x' or str[offset] ==
'X') {
40 for (; i != str.size(); ++i) {
43 if (radius >= 16 and c >=
'a' and c <=
'f') {
45 value +=
c -
'a' + 10;
46 }
else if (radius >= 16 and c >=
'A' and c <=
'F') {
48 value +=
c -
'A' + 10;
49 }
else if (radius >= 10 and c >=
'8' and c <=
'9') {
52 }
else if (radius >= 8 and c >=
'2' and c <=
'7') {
55 }
else if (radius >= 2 and c >=
'0' and c <=
'1') {
58 }
else if (c ==
'\'') {
75template<std::
integral T>
83 hilet[new_last, ec] = std::to_chars(first, last, value);
97template<std::
floating_po
int T>
105 hilet[new_last, ec] = std::to_chars(first, last, value, std::chars_format::general);
121template<std::
integral T>
126 hilet first = str.data();
127 hilet last = first + ssize(str);
129 hilet[new_last, ec] = std::from_chars(first, last, value, base);
130 if (ec !=
std::errc{} or new_last != last) {
131 throw parse_error(
"Can not convert string to integer");
144template<std::
floating_po
int T>
149 hilet first = str.data();
150 hilet last = first + ssize(str);
152 hilet[new_last, ec] = std::from_chars(first, last, value);
153 if (ec !=
std::errc{} or new_last != last) {
154 throw parse_error(
"Can not convert string to floating point");
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:184
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
constexpr std::string to_string(std::u32string_view rhs) noexcept
Conversion from UTF-32 to UTF-8.
Definition to_string.hpp:215
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
T from_string(std::string_view str, int base=10)
Convert a string to an integer.
Definition charconv.hpp:122
Exception thrown during parsing on an error.
Definition exception.hpp:50
T back_inserter(T... args)