A
Andrew Bullock
Hi,
I want to create a vector of templates, but I've come across a problem....
Here is a trimmed version of my template definition:
template<class T>
class variant
{
public:
variant(T val)
{
_val = val;
}
private:
T _val;
};
i want to create a vector of these, where T can be various types,
however when i create the vector, i need to specify a single type, eg:
std::vector<variant<XXX>> vars;
where XXX is a specific type.
Someone recommended i make the template extend a superclass, but im not
sure how exactly that would work.
Does that make sense?
Is there a way round this?
Thanks
Andrew Bullock
I want to create a vector of templates, but I've come across a problem....
Here is a trimmed version of my template definition:
template<class T>
class variant
{
public:
variant(T val)
{
_val = val;
}
private:
T _val;
};
i want to create a vector of these, where T can be various types,
however when i create the vector, i need to specify a single type, eg:
std::vector<variant<XXX>> vars;
where XXX is a specific type.
Someone recommended i make the template extend a superclass, but im not
sure how exactly that would work.
Does that make sense?
Is there a way round this?
Thanks
Andrew Bullock