Is is possible to create a template method with flexible parameter list, like this:
class TestA
{
public:
TestA(int i, int j) { ... }
}
class TestB
{
public:
TestB(std::string a) { ... }
}
class Base
{
public:
template<class T>
bool add( ... )
{
... new T( **PARA** );
}
}
With PARA replaced by the parameter list. Class TestA and TestB knows which parameter they need ( how much parameters and type ) so it would be possible with va_args?
Is there a better way of doing it ?
base.add<TestA>(1,2);
base.add<TestB>( "abc" );