73 if constexpr (std::is_same_v<T, float>)
74 f = std::stof(std::string(s.
value), &end_index);
75 else if constexpr (std::is_same_v<T, double>)
76 f = std::stod(std::string(s.
value), &end_index);
77 else if constexpr (std::is_same_v<T, long double>)
78 f = std::stold(std::string(s.
value), &end_index);
79 else if constexpr (std::is_same_v<T, signed char>)
80 f =
static_cast<signed char>(
81 std::stoi(std::string(s.
value), &end_index, 0));
82 else if constexpr (std::is_same_v<T, short>)
83 f =
static_cast<short>(
84 std::stoi(std::string(s.
value), &end_index, 0));
85 else if constexpr (std::is_same_v<T, int>)
86 f = std::stoi(std::string(s.
value), &end_index, 0);
87 else if constexpr (std::is_same_v<T, long>)
88 f = std::stol(std::string(s.
value), &end_index, 0);
89 else if constexpr (std::is_same_v<T, long long>)
90 f = std::stoll(std::string(s.
value), &end_index, 0);
91 else if constexpr (std::is_same_v<T, unsigned char>)
92 f =
static_cast<unsigned char>(
93 std::stoul(std::string(s.
value), &end_index, 0));
94 else if constexpr (std::is_same_v<T, unsigned short>)
95 f =
static_cast<unsigned short>(
96 std::stoul(std::string(s.
value), &end_index, 0));
97 else if constexpr (std::is_same_v<T, unsigned int>)
98 f =
static_cast<unsigned int>(
99 std::stoul(std::string(s.
value), &end_index, 0));
100 else if constexpr (std::is_same_v<T, unsigned long>)
101 f = std::stoul(std::string(s.
value), &end_index, 0);
102 else if constexpr (std::is_same_v<T, unsigned long long>)
103 f = std::stoull(std::string(s.
value), &end_index, 0);
105 static_assert(std::is_same_v<T, void>);
106 }
catch (std::exception &e) {
107 throw std::invalid_argument(
"Invalid value '" + std::string(s.
value) +
110 std::string(s.
full_key) +
"': " + e.what());
112 return s.
value.data() + end_index;