mercredi 3 février 2016

How do I create a type list to expand into a tuple?

I am trying to create a class that has a tuple of all the types that are passed to it. I want it to take a type list as a template parameter, and use the classes within that list as the classes an internal tuple will contain. Currently, I have something like this, which doesn't actually compile.

template<class ... T>
struct ComponentList {};

template<ComponentList<typename ...T> >
class ComponentManager{
    std::tuple<T...> components;
};

The reason I want to have ComponentList be its own type is because I want to also pass in other type lists later. Is this possible? If not, what would be an alternative that will work?

Aucun commentaire:

Enregistrer un commentaire