Add Tag to meta info
This commit is contained in:
parent
219233d846
commit
d84161f18f
1 changed files with 11 additions and 13 deletions
|
@ -11,28 +11,26 @@ struct Types {};
|
||||||
} // namespace impl
|
} // namespace impl
|
||||||
|
|
||||||
|
|
||||||
template <std::size_t Id>
|
template <std::size_t Id, typename Tag>
|
||||||
struct MetaInfoKey {
|
struct MetaInfoKey {};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, typename Tag = impl::Types>
|
||||||
struct MetaInfo {
|
struct MetaInfo {
|
||||||
static constexpr std::size_t kTypeId = loopholes::Counter<impl::Types, T>();
|
static constexpr std::size_t kTypeId = loopholes::Counter<Tag, T>();
|
||||||
using Type = T;
|
using Type = T;
|
||||||
private:
|
private:
|
||||||
static constexpr auto _ = loopholes::Injector<MetaInfoKey<kTypeId>{}, TypeList<T>{}>{};
|
static constexpr auto _ = loopholes::Injector<MetaInfoKey<kTypeId, Tag>{}, TypeList<T>{}>{};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T, typename Tag = impl::Types>
|
||||||
inline constexpr std::size_t kTypeId = MetaInfo<T>::kTypeId;
|
inline constexpr std::size_t kTypeId = MetaInfo<T, Tag>::kTypeId;
|
||||||
|
|
||||||
template <std::size_t Id>
|
template <std::size_t Id, typename Tag = impl::Types>
|
||||||
using GetMetaInfo = MetaInfo<typename decltype(Magic(loopholes::Getter<MetaInfoKey<Id>{}>{}))::Type>;
|
using GetMetaInfo = MetaInfo<typename decltype(Magic(loopholes::Getter<MetaInfoKey<Id, Tag>{}>{}))::Type>;
|
||||||
|
|
||||||
template <std::size_t Id>
|
template <std::size_t Id, typename Tag = impl::Types>
|
||||||
using GetType = GetMetaInfo<Id>::Type;
|
using GetType = GetMetaInfo<Id, Tag>::Type;
|
||||||
|
|
||||||
} // namespace utempl
|
} // namespace utempl
|
||||||
|
|
Loading…
Reference in a new issue