7#include "../macros.hpp"
9#include "exception.hpp"
16hi_export_module(hikogui.utility.charconv);
18hi_export
namespace hi {
inline namespace v1 {
26template<std::
integral T>
32 auto const last = first +
buffer.size();
34 auto const[
new_last,
ec] = std::to_chars(first, last, value);
48template<std::
floating_po
int T>
54 auto const last = first +
buffer.size();
56 auto const[
new_last,
ec] = std::to_chars(first, last, value, std::chars_format::general);
72template<std::
integral T>
77 auto const first = str.data();
78 auto const last = first +
ssize(str);
80 auto const[
new_last,
ec] = std::from_chars(first, last, value, base);
82 throw parse_error(
"Can not convert string to integer");
95template<std::
floating_po
int T>
100 auto const first = str.data();
101 auto const last = first +
ssize(str);
103 auto const[
new_last,
ec] = std::from_chars(first, last, value);
105 throw parse_error(
"Can not convert string to floating point");
Utilities for throwing exceptions and terminating the application.
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
The HikoGUI namespace.
Definition recursive_iterator.hpp:15
T from_string(std::string_view str, int base=10)
Convert a string to an integer.
Definition charconv.hpp:73
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378
Exception thrown during parsing on an error.
Definition exception_intf.hpp:48
T back_inserter(T... args)