27 using std::invalid_argument::invalid_argument;
32inline auto split_key(std::string_view full,
char tok =
'.') {
33 auto tok_pos = full.find(tok);
34 if (tok_pos == full.npos)
35 return std::make_tuple(full, std::string_view{});
36 std::string_view key{full.begin(), full.begin() + tok_pos};
37 std::string_view rem{full.begin() + tok_pos + 1, full.end()};
38 return std::make_tuple(key, rem);
50 T &t, std::string_view prefix, std::span<const std::string_view> options,
51 std::optional<std::span<bool>> used = std::nullopt) {
54 for (
const auto &kv : options) {
57 auto curr_index = index++;
61 (*used)[curr_index] =
true;
62 set_param(t, {.full_key = kv, .key = remainder, .value = value});
70 std::optional<vec> value = std::nullopt;
#define USING_ALPAQA_CONFIG(Conf)
void set_param(bool &b, ParamString s)
void set_params(T &t, std::string_view prefix, std::span< const std::string_view > options, std::optional< std::span< bool > > used=std::nullopt)
Overwrites t based on the options that start with prefix.
std::string_view key
The subkey to resolve next.
std::string_view full_key
Full key string, used for diagnostics.
auto split_key(std::string_view full, char tok='.')
Split the string full on the first occurrence of tok.
std::string_view value
The value of the parameter to store.
Represents a parameter value encoded as a string in the format abc.def.key=value.
typename Conf::length_t length_t
Custom parameter parsing exception.