I am trying to create a generic class that processes ints, doubles and string. However, when I try to instantiate the template class, I get the following error message:
error: 'double' is not a valid type for a template constant parameter
Contextual creation works completely with int types, as well as internal code, although I haven't finished it with string types yet. It seems like this should be good, as you can instantiate a vector, etc. Is there something I'm missing here?
template<typename NODETYPE> class Forest
{
template<NODETYPE>
friend Forest<NODETYPE>& operator+(Forest<NODETYPE>& f1,
Forest<NODETYPE>& f2);
template<NODETYPE>
friend ostream& operator<<(ostream& output,
const Forest<NODETYPE>& f1);
template<NODETYPE>
friend void outputHelper(ostream& output,
const ForestNode<NODETYPE>& currentNode,
int depth);
};
The error occurs as follows:
\project 4\forest.h|341|instantiated from here|
\project 4\forest.h|15|error: 'double' is not a valid type for a template constant parameter|
\project 4\forest.h|17|error: 'double' is not a valid type for a template constant parameter|
\project 4\forest.h|19|error: 'double' is not a valid type for a template constant parameter|
source
share