| 190 | |
| 191 | std::optional<float> parse_float_option( |
| 192 | const std::unordered_map<std::string, std::string> & options, |
| 193 | std::initializer_list<std::string_view> keys) { |
| 194 | if (const auto match = find_option_match(options, keys)) { |
| 195 | return parse_float_value(match->value, match->key); |
| 196 | } |
| 197 | return std::nullopt; |
| 198 | } |
| 199 | |
| 200 | std::optional<float> parse_finite_float_option( |
| 201 | const std::unordered_map<std::string, std::string> & options, |
| 202 | std::initializer_list<std::string_view> keys) { |
| 203 | if (const auto match = find_option_match(options, keys)) { |
| 204 | const float value = parse_float_value(match->value, match->key); |
| 205 | if (!std::isfinite(value)) { |
| 206 | throw std::runtime_error(match->key + " must be a finite float"); |
| 207 | } |
no test coverage detected