samedi 27 janvier 2018

Unpacking parameter packs multiple times

Is it possible to unpack a parameter pack more than one time?

For example: I want to get a tuple containing 4 vectors - 2 of type int and 2 of type float. To create such a tuple I want to use the syntax as follows:

ExampleClass<2, int, float> class;

Is it possible to create such a class? I'm thinking about something like this:

template <int numUnpacks, typename ... Types>
class ExampleClass
{
     using Types = std::tuple<std::vector<Types>...>; // here i don't know how to unpack "std::vector<Types>...>" as often as "numUnpacks">
}

Aucun commentaire:

Enregistrer un commentaire