2#include <ossia/detail/config.hpp>
8#if defined(__cpp_lib_to_chars)
11#include <boost/spirit/home/x3.hpp>
22#if defined(__cpp_lib_to_chars)
24static std::optional<T> parse_relax(std::string_view v)
28 const auto begin = v.data();
29 const auto end = v.data() + v.size();
30 const auto [ptr, ec] = std::from_chars(begin, end, n);
31 return (ec == std::errc{}) ? std::optional<T>{n} : std::nullopt;
35static std::optional<T> parse_relax(std::string_view v);
38std::optional<int> parse_relax<int>(std::string_view v)
40 using boost::spirit::x3::int_;
42 int err = boost::spirit::x3::parse(v.begin(), v.end(), int_, x);
48std::optional<float> parse_relax<float>(std::string_view v)
50 using boost::spirit::x3::float_;
52 int err = boost::spirit::x3::parse(v.begin(), v.end(), float_, x);
58std::optional<double> parse_relax<double>(std::string_view v)
60 using boost::spirit::x3::double_;
62 int err = boost::spirit::x3::parse(v.begin(), v.end(), double_, x);