From d790df640374f4320dbb398686df8fbafe761a21 Mon Sep 17 00:00:00 2001 From: sha512sum Date: Sun, 21 Apr 2024 02:25:45 +0000 Subject: [PATCH] Add AddTypeToTag --- include/utempl/meta_info.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/include/utempl/meta_info.hpp b/include/utempl/meta_info.hpp index 9203d5f..ace4259 100644 --- a/include/utempl/meta_info.hpp +++ b/include/utempl/meta_info.hpp @@ -25,6 +25,19 @@ private: template inline constexpr std::size_t kTypeId = MetaInfo::kTypeId; +template < + typename Tag, + typename T, + typename... Ts, + typename... TTs, + std::size_t Id = loopholes::Counter(), + auto = loopholes::Injector{}, TypeList{}>{} +> +consteval std::size_t AddTypeToTag(TTs&&...) { + return Id; +}; + + template using GetMetaInfo = MetaInfo{}>{}))::Type>; @@ -60,7 +73,9 @@ consteval auto GetTypeListForTag() { /* static_assert(kTypeId == 0); static_assert(kTypeId == 1); -static_assert(std::is_same_v>); +static_assert(AddTypeToTag() == 2); +static_assert(std::is_same_v>); + */