Made some Meta stuff more generic

This commit is contained in:
Stephen Seo 2016-03-14 17:53:57 +09:00
parent de07c8ad1a
commit c3f90ec6b0
4 changed files with 12 additions and 12 deletions

View file

@ -14,8 +14,8 @@ namespace EC
using type = TypeList<>; using type = TypeList<>;
}; };
template <typename... TypesA, typename... TypesB> template <template <typename...> class TTypeListA, template <typename...> class TTypeListB, typename... TypesA, typename... TypesB>
struct CombineHelper<TypeList<TypesA...>, TypeList<TypesB...> > struct CombineHelper<TTypeListA<TypesA...>, TTypeListB<TypesB...> >
{ {
using type = TypeList<TypesA..., TypesB...>; using type = TypeList<TypesA..., TypesB...>;
}; };

View file

@ -15,12 +15,12 @@ namespace EC
{ {
}; };
template <typename T, typename Type, typename... Types> template <typename T, template <typename...> class TTypeList, typename Type, typename... Types>
struct ContainsHelper<T, TypeList<Type, Types...> > : struct ContainsHelper<T, TTypeList<Type, Types...> > :
std::conditional< std::conditional<
std::is_same<T, Type>::value, std::is_same<T, Type>::value,
std::true_type, std::true_type,
ContainsHelper<T, TypeList<Types...> > ContainsHelper<T, TTypeList<Types...> >
>::type >::type
{ {
}; };

View file

@ -15,8 +15,8 @@ namespace EC
{ {
}; };
template <typename Type, typename... Types, typename TTypeListB> template <template <typename...> class TTypeListA, typename Type, typename... Types, typename TTypeListB>
struct ContainsAllHelper<TypeList<Type, Types...>, TTypeListB> : struct ContainsAllHelper<TTypeListA<Type, Types...>, TTypeListB> :
std::conditional< std::conditional<
Contains<Type, TTypeListB>::value, Contains<Type, TTypeListB>::value,
ContainsAllHelper<TypeList<Types...>, TTypeListB>, ContainsAllHelper<TypeList<Types...>, TTypeListB>,

View file

@ -13,16 +13,16 @@ namespace EC
{ {
}; };
template <typename T, typename... Types> template <typename T, template <typename...> class TTypeList, typename... Types>
struct IndexOf<T, TypeList<T, Types...> > : struct IndexOf<T, TTypeList<T, Types...> > :
std::integral_constant<std::size_t, 0> std::integral_constant<std::size_t, 0>
{ {
}; };
template <typename T, typename Type, typename... Types> template <typename T, template <typename...> class TTypeList, typename Type, typename... Types>
struct IndexOf<T, TypeList<Type, Types...> > : struct IndexOf<T, TTypeList<Type, Types...> > :
std::integral_constant<std::size_t, 1 + std::integral_constant<std::size_t, 1 +
IndexOf<T, TypeList<Types...> >::value IndexOf<T, TTypeList<Types...> >::value
> >
{ {
}; };