52 if constexpr (std::is_same_v<T, float>)
53 f = std::stof(std::string(s.
value), &end_index);
54 else if constexpr (std::is_same_v<T, double>)
55 f = std::stod(std::string(s.
value), &end_index);
56 else if constexpr (std::is_same_v<T, long double>)
57 f = std::stold(std::string(s.
value), &end_index);
58 else if constexpr (std::is_same_v<T, signed char>)
59 f =
static_cast<signed char>(
60 std::stoi(std::string(s.
value), &end_index, 0));
61 else if constexpr (std::is_same_v<T, short>)
62 f =
static_cast<short>(
63 std::stoi(std::string(s.
value), &end_index, 0));
64 else if constexpr (std::is_same_v<T, int>)
65 f = std::stoi(std::string(s.
value), &end_index, 0);
66 else if constexpr (std::is_same_v<T, long>)
67 f = std::stol(std::string(s.
value), &end_index, 0);
68 else if constexpr (std::is_same_v<T, long long>)
69 f = std::stoll(std::string(s.
value), &end_index, 0);
70 else if constexpr (std::is_same_v<T, unsigned char>)
71 f =
static_cast<unsigned char>(
72 std::stoul(std::string(s.
value), &end_index, 0));
73 else if constexpr (std::is_same_v<T, unsigned short>)
74 f =
static_cast<unsigned short>(
75 std::stoul(std::string(s.
value), &end_index, 0));
76 else if constexpr (std::is_same_v<T, unsigned int>)
77 f =
static_cast<unsigned int>(
78 std::stoul(std::string(s.
value), &end_index, 0));
79 else if constexpr (std::is_same_v<T, unsigned long>)
80 f = std::stoul(std::string(s.
value), &end_index, 0);
81 else if constexpr (std::is_same_v<T, unsigned long long>)
82 f = std::stoull(std::string(s.
value), &end_index, 0);
84 static_assert(std::is_same_v<T, void>);
85 }
catch (std::exception &e) {
86 throw std::invalid_argument(
"Invalid value '" + std::string(s.
value) +
89 std::string(s.
full_key) +
"': " + e.what());
91 return s.
value.data() + end_index;