Hi all, I am trying to create a generic class that handles ints, doubles, and strings. However, when trying to instantiate the template class with I get the following error message:
error: 'double' is not a valid type for a template constant parameter
The instantiation works completely fine with int types, as does the internal code, though I haven't made it to string types yet. It seems as if this should be fine, since you can instantiate vector, etc. Is there something I am missing here?
// file forest.h
template<typename NODETYPE> class Forest
{
template<NODETYPE> // Line 15
friend Forest<NODETYPE>& operator+(Forest<NODETYPE>& f1,
Forest<NODETYPE>& f2);
template<NODETYPE> // Line 17
friend ostream& operator<<(ostream& output,
const Forest<NODETYPE>& f1);
template<NODETYPE> // Line 19
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|