I have a template class: templClass
which takes in a type and works like a regular template class. I want that class to be a member of another regular class regClass
. regClass
has a member variable var
, based on which I wish to create templClass
of type1
or type2
: So it is as follows
template <class T>
class templClass
{
//constructor
};
class regClass
{
public:
regClass()
{
// constructor for other members
}
int var;
templClass templClass_;
// if (var == 0)
// {I want templClass<type1>}
// else
// {I want templClass<type2>}
};
How can I achieve this? The implementation above throws a compiler error error: invalid use of template-name 'templClass' without an argument list
Aucun commentaire:
Enregistrer un commentaire