diff --git a/include/utempl/type_list.hpp b/include/utempl/type_list.hpp index 232ec36..41a9b6d 100644 --- a/include/utempl/type_list.hpp +++ b/include/utempl/type_list.hpp @@ -4,6 +4,7 @@ #include #include + namespace utempl { namespace impl { @@ -29,6 +30,12 @@ template consteval auto operator==(const TypeList& first, const TypeList& second) -> bool { return std::same_as; }; + +template +consteval auto operator+(const TypeList&, const TypeList&) -> TypeList { + return {}; +}; + template consteval auto Get(std::index_sequence, decltype(impl::Caster(Is))..., T, ...) -> T; @@ -52,5 +59,10 @@ template consteval auto Transform(TypeList, auto&& f) -> TypeList{}))...> { return {}; }; +template +consteval auto Filter(TypeList, auto&& f) { + return ([](auto&& list){if constexpr(decltype(f(list))::kValue) {return list;} else {return kTypeList<>;}}(kType) + ...); +}; + } // namespace utempl