14 template <
typename T,
typename... Types>
15 struct IsOneOf : std::disjunction<std::is_same<T, Types>...> { };
18 template <
typename... Settings>
21 constexpr std::array<std::string_view,
sizeof...(Settings)> paths = { Settings::path... };
22 for (std::size_t i = 0; i < paths.size(); ++i) {
23 for (std::size_t j = i + 1; j < paths.size(); ++j) {
24 if (paths[i] == paths[j]) {
58template <IsSetting... Settings>
61 static constexpr std::size_t
size =
sizeof...(Settings);
70 [[nodiscard]]
static constexpr auto GetPaths() -> std::array<std::string_view, size>
72 return { Settings::path... };
76 [[nodiscard]]
static constexpr auto Size() -> std::size_t {
return size; }
82 template <
typename Fn>
85 (fn.template operator()<Settings>(), ...);
Configuration schema holding all setting types.
Definition schema.h:59
static constexpr bool has_setting
Checks if a setting type is in this schema.
Definition schema.h:67
static constexpr std::size_t size
Definition schema.h:61
static constexpr auto Size() -> std::size_t
Returns the number of settings in the schema.
Definition schema.h:76
static void ForEachSetting(Fn &&fn)
Iterates over all setting types with a callable.
Definition schema.h:83
static constexpr auto GetPaths() -> std::array< std::string_view, size >
Returns all paths as a compile-time array.
Definition schema.h:70
consteval auto AllPathsUnique() -> bool
Helper to check if all paths are unique at compile time.
Definition schema.h:19
C++20 compile-time type-safe configuration library.
Definition conf.h:13
typename S::value_type setting_value_type
Helper alias to get the value type for a setting.
Definition schema.h:91
Helper to check if a type is in a parameter pack.
Definition schema.h:15