I donβt know what Loki or DL32 is, and itβs not clear that you have to implement anything at all.
std::tuple is a general tool for type lists. It is designed as a storage container at runtime, but works as a compilation utility if the types are complete. Here is one way to bind tuples:
template< typename ... t > struct tuple_cat { typedef decltype( std::tuple_cat( std::declval< t >() ... ) ) type; };
If you want to do this manually, try partial specialization:
template< typename ... t > struct type_list {}; template< typename ta, typename tb > struct type_cat; template< typename ... a, typename ... b > struct type_cat< type_list< a ... >, type_list< b ... > > { typedef type_list< a ..., b ... > type; };
As for the size member, you can make a universal metafound to solve the problem once and for all.
template< typename > struct count_types; template< template< typename ... > class t, typename ... a > struct count_types< t< a ... > > { static constexpr std::size_t value = sizeof ... a; };
source share