I'm trying to add class template to tuple
These are my classes:
class Parent {
// ...
}
class Child1 : public Parent {
// ...
}
class Child2 : public Parent {
// ...
}
My purpose is to add class like this way:
v.push_back({"child1", Child1});
so that I can save class template to create an object like this way:
Parent *obj = new v[0][1]();
which should work like this:
Parent *obj = new Child1();
I trid this:
std::vector<std::tuple<std::string, template<class T>>> v;
to add template to tuple.
How can I make it work?