diff --git a/include/utempl/meta_info.hpp b/include/utempl/meta_info.hpp index 3117beb..612eb77 100644 --- a/include/utempl/meta_info.hpp +++ b/include/utempl/meta_info.hpp @@ -21,7 +21,6 @@ struct MetaInfo { using Type = T; private: static constexpr auto _ = loopholes::Injector{}, TypeList{}>{}; - }; template @@ -33,4 +32,37 @@ using GetMetaInfo = MetaInfo using GetType = GetMetaInfo::Type; +namespace impl { + +template +static consteval auto GetTypeListForTag(G g) requires (I == 0 || + requires {Magic(loopholes::Getter{}>{});}) { + if constexpr(I == 0 && !requires {Magic(loopholes::Getter{}>{});}) { + return TypeList{}; + } else { + if constexpr(requires{GetTypeListForTag(g);}) { + constexpr auto type = Magic(loopholes::Getter{}>{}); + return GetTypeListForTag(g); + } else { + constexpr auto type = Magic(loopholes::Getter{}>{}); + return TypeList(); + }; + }; +}; + + +} // namespace impl + +template +consteval auto GetTypeListForTag() { + return impl::GetTypeListForTag(TypeList{}); +}; + +/* +static_assert(kTypeId == 0); +static_assert(kTypeId == 1); +static_assert(std::is_same_v>); +*/ + + } // namespace utempl