E
er ci
Hello,
I have a function g, overloaded on # of arguments, which forwards to
f:
template<typename F>
struct foo{
foo(){}
void g(){ this->f(); }
template<typename T0> void g(T0& a){ this->f( a ); }
template<typename T0,typename T1> void g(T0& a,T1& b){ this->f( a,
b ); }
// etc. a certain number of times. Usually this is done with a pp
macro.
private:
F f;
};
f need not be defined for each overload, only those that are actually
called.
I was hoping, naively as it turns out, that in C++0x, the above could
be replaced by
template<typename... Args>
void g(Args... args){ this->f(args); }
but the compiler says "parameter pack not expanded with".
Any suggestion, please (besides learning C++0x, thank you very much,
that's what I'm trying to do here)?
I have a function g, overloaded on # of arguments, which forwards to
f:
template<typename F>
struct foo{
foo(){}
void g(){ this->f(); }
template<typename T0> void g(T0& a){ this->f( a ); }
template<typename T0,typename T1> void g(T0& a,T1& b){ this->f( a,
b ); }
// etc. a certain number of times. Usually this is done with a pp
macro.
private:
F f;
};
f need not be defined for each overload, only those that are actually
called.
I was hoping, naively as it turns out, that in C++0x, the above could
be replaced by
template<typename... Args>
void g(Args... args){ this->f(args); }
but the compiler says "parameter pack not expanded with".
Any suggestion, please (besides learning C++0x, thank you very much,
that's what I'm trying to do here)?