You can add a template for reconfiguring parameters from your list of type types in std::tuple :
template<class A, template<class...> class B> struct rebind_; template<template<class...> class A, class... T, template<class...> class B> struct rebind_<A<T...>, B> { using type = B<T...>; }; template<class A, template<class...> class B> using rebind = typename rebind_<A, B>::type;
Then use it like this:
template<class... T> struct ComponentList {}; template<class List> struct ComponentManager { rebind<List, std::tuple> components; }; int main() { using List = ComponentList<int, char, long>; ComponentManager<List> manager; std::cout << std::get<0>(manager.components) << '\n'; }
I assume that if you want the source type to be a ComponentList , you can use enable_if and is_instantiation_of :
template<class List, typename = std::enable_if<is_instantiation_of<List, ComponentList>::value>::type> struct ComponentManager { rebind<List, std::tuple> components; };
Jon purdy
source share