diff --git a/include/utempl/type_list.hpp b/include/utempl/type_list.hpp index 3edf7da..5d098f9 100644 --- a/include/utempl/type_list.hpp +++ b/include/utempl/type_list.hpp @@ -8,17 +8,8 @@ namespace utempl { -namespace impl { - -struct Caster { - constexpr Caster(auto&&) {}; -}; - -}; - template -struct TypeList { -}; +struct TypeList {}; template struct TypeList { @@ -38,7 +29,20 @@ concept IsTypeList = Overloaded( )(kType>); +namespace impl { +template +struct IndexedType {}; + +template +struct Caster {}; + +template +struct Caster, Ts...> : IndexedType... {}; + + + +} // namespace impl template consteval auto operator==(const TypeList& first, const TypeList& second) -> bool { return std::same_as; @@ -49,11 +53,10 @@ consteval auto operator+(const TypeList&, const TypeList&) -> Typ return {}; }; -template -consteval auto Get(std::index_sequence, decltype(impl::Caster(Is))..., T&& arg, ...) -> T; - template -consteval auto Get(const TypeList&) -> decltype(Get(std::make_index_sequence(), std::declval()...)) requires (I < sizeof...(Ts)); +consteval auto Get(TypeList) -> decltype( + [](impl::IndexedType&&) -> T { +}(impl::Caster, Ts...>{})); template consteval auto Find(TypeList) -> std::size_t {