1#ifndef CONFIG_EXTRACTOR_HPP_
2#define CONFIG_EXTRACTOR_HPP_
18 template<
auto... Values>
19 struct NormalizedIntegerSequence {};
21 template<
typename StdIndexSequence>
24 template<
auto... Values>
26 std::integer_sequence<
32 using type = NormalizedIntegerSequence<Values...>;
35 template<
typename StdIndexSequence>
36 using normalize_t =
typename Normalize<StdIndexSequence>::type;
39 template<
typename>
typename Predicate
41 struct ConfigToIndexMapper
46 template<
typename Config, std::
size_t Index>
47 struct Mapper<meta::Pack<Config, meta::ValueUnit<Index>>>
49 using type = std::conditional_t<
50 Predicate<Config>::value,
51 meta::ValueUnit<Index>,
58 template<
typename>
typename Predicate,
61 struct ConfigsToIndexSequence
63 using ConfigsPack = meta::Pack<Configs...>;
65 using ConfigsIndexSequence = std::index_sequence_for<Configs...>;
66 using NormalizedConfigsIndexSequence = normalize_t<ConfigsIndexSequence>;
67 using ConfigsIndicesPack = meta::rebind_valued_as_typed_t<
68 NormalizedConfigsIndexSequence,
69 NormalizedIntegerSequence,
72 using ConfigsToIndicesPack = meta::pack_zip_t<ConfigsPack, ConfigsIndicesPack>;
74 using type = meta::pack_filter_map_t<
77 ConfigToIndexMapper<Predicate>::template Mapper,
84 template<
typename>
typename Predicate,
87 using configs_to_index_sequence_pack_t =
typename ConfigsToIndexSequence<
93 template<std::size_t... Idx,
typename... Configs>
94 [[nodiscard]]
constexpr auto
96 meta::Pack<meta::ValueUnit<Idx>...>&&,
100 std::tuple<Configs&...> configs_tuple = { configs... };
101 return std::tuple { std::move(std::get<Idx>(configs_tuple))... };
108 template<
typename>
typename Predicate,
111[[nodiscard]]
constexpr auto
117 using ConfigsIndexSequencePack =
118 implementation_details_::configs_to_index_sequence_pack_t<
123 return implementation_details_::extract_config_tuple(
124 ConfigsIndexSequencePack{},
Compile-time type pack utilities and metaprogramming foundations.
Definition DependencyTags.hpp:18
Definition Decorator.hpp:19
constexpr auto filter_configs(meta::UnaryMetaFunction< Predicate > &&predicates, Configs &... configs) noexcept
Definition ConfigClassifier.hpp:112