mercredi 25 janvier 2017

C++ passsing parameter pack to class

I'd like to have a class that gets in it's Ctor unlimited parameters of the same type, and stores them into a vector. It should look like that:

class A(int a, int b, **N time parameter of type T**)
: data(**vector will get N times type T**)
{
}

protected:
vector<T> data;

How should I implement it? Solution could be in c++11/14 I got a few errors such as "parameter packs not expanded with ‘…' ", etc..

Aucun commentaire:

Enregistrer un commentaire