6#include <nlohmann/json.hpp>
15 auto keys = std::views::keys(members);
23 requires requires { attribute_table<T, json>::table; }
28 "' (expected object, but got " +
33 for (
auto &&
el :
j.items()) {
34 const auto &key =
el.key();
35 auto it = members.find(key);
37 if (it == members.end()) {
45 "Invalid key '" + key +
"' for type '" +
47 "',\n possible keys are: " +
53 if (it == members.end())
54 throw std::logic_error(
55 "Alias '" + std::string(
alias_it->first) +
56 "' refers to nonexistent option '" +
57 std::string(
alias_it->second) +
"' in '" +
65 "',\n possible keys are: " +
71 it->second.set(t,
el.value());
81 requires requires { enum_table<T, json>::table; }
86 "' (expected string, but got " +
90 std::string value =
j;
91 auto it = m.find(value);
94 "Invalid value '" + value +
"' for enum '" +
102 requires requires { enum_table<T, json>::table; }
108 requires requires { attribute_table<T, json>::table; }
112 for (
auto &&[k,
v] : m)
std::string demangled_typename(const std::type_info &t)
Get the pretty name of the given type as a string.
std::string join_sorted_keys(const auto &members)
void get_param(const T &t, json &j)
Get the first argument as a JSON object j.
void set_param(T &t, const json &j)
Update/overwrite the first argument based on the JSON object j.
Specialize this type to define the alternative attribute name to attribute setters dictionaries for a...
Specialize this type to define the attribute name to attribute setters dictionaries for a struct type...
Specialize this type to define the enumerator name to value dictionaries for an enum type T.
std::string join(std::ranges::input_range auto strings, join_opt opt={})
Join the list of strings into a single string, using the separator given by opt.
void sort_case_insensitive(auto &range)
Sort the given range of strings in-place in a case-insensitive manner.
EigenConfigd DefaultConfig
constexpr const char * enum_name(LBFGSStepSize s)
Double-precision double configuration.
Custom parameter parsing exception.
std::vector< std::string > backtrace