I have a class with which I'm wrapping some information, for example:
template<typename T>
class Type
{
pubilc:
Type(const T value) : m_value(value) {}
T GetValue() const { return m_value; }
private:
T m_value;
};
And I want to store a bunch of these in a container. But to do this they all need to use the same template param. To work around this I have been doing:
class TypeBase
{}
template<typename T>
class Type : public TypeBase
{
pubilc:
Type(const T value) : m_value(value) {}
T GetValue() const { return m_value; }
private:
T m_value;
};
and storing TypeBase*
in my container.
Is there a better way to work around this?