Is there a way to set the template argument of a template class inside another class? Imagine (just for illustrative purposes) that I want to have a class that generates an std::vector of a certain type (int, double etc.) with two values. The class should be called like this:
Vector IntVec("int",1,2) // this should construct std::vector<int> v = {1,2};
Vector DoubleVec("double",1.0,2.0); //std::vector<double> v = {1.,2.};
One way would be to make the Vector class a template class as well. But I would like to know if it is possible to do it the way shown above.
Aucun commentaire:
Enregistrer un commentaire