J
Johan
Hi,
Hi like to create a linked list with a template class ( see below ). How to
make one using the STL container list.
I want to create a linked list with different kind of types i.e.
DataVariant<int>, DataVariant<string> etc, etc
#include <list>
using namespace std;
list<....what to put here for your template class ....> DataList;
template <class T>class DataVariant
{
public :
DataVariant(T value);
T getValue();
private :
T value;
};
template <class T>DataVariant<T> :: DataVariant(T value)
: value(value)
{
}
template <class T>T DataVariant<T> :: getValue()
{
return value;
}
regards Johan
Hi like to create a linked list with a template class ( see below ). How to
make one using the STL container list.
I want to create a linked list with different kind of types i.e.
DataVariant<int>, DataVariant<string> etc, etc
#include <list>
using namespace std;
list<....what to put here for your template class ....> DataList;
template <class T>class DataVariant
{
public :
DataVariant(T value);
T getValue();
private :
T value;
};
template <class T>DataVariant<T> :: DataVariant(T value)
: value(value)
{
}
template <class T>T DataVariant<T> :: getValue()
{
return value;
}
regards Johan