something
is a template not a type, but you can only have objects of one type in a vector
. Different instantiations of something
are completely unrelated, unless you use a base class:
struct something_base {};
template<typename...Args>
class something : something_base {
//...
};
And now you can have a std::vector<std::unique_ptr<something_base>>
and push instances of different isntantiations of something
into that vector.
There are alternatives for type erasure (eg std::any
, std::variant
). What is most appropriate depends on what you want to do with the elements in the vector.