lundi 22 décembre 2014

How can I store the arguments of a variadic type?

I want to call this foo function from the action member function, instead of the constructor.

For that, I have to store the values somewhere.

I can not figure out the syntax to do this.



#include <iostream>
void foo(int a, int b)
{
std::cout<<a<<b;
}
template<typename... Args>
struct Foo
{
public:
Foo(Args... args){foo(args...);}
void action(){}
private:
//Args... ?
};

int main()
{
Foo<int,int> x(1,2);
}

Aucun commentaire:

Enregistrer un commentaire