Class templating std::set key types
- by TomFLuff
I have a class to evaluate set algebra but wish to template it.
At the minute it looks a bit like this
set.h:
template<typename T>
class SetEvaluation
{
public:
SetEvaluation<T>();
std::set<T>
evaluate(std::string in_expression);
}
set.cpp
template<typename T>
std::set<T>
SetEvaluation<T>::evaluate(std::string expression)
{
std::set<T> result;
etc etc...
}
But i'm getting undefined reference errors when compiling.
Is it possible to declare the return type as std::set<T> and then pass std::string as the class template param.
There are no errors in the class but only when I try to instantiate SetEvaluation<std::string>
Can anyone shed light on this problem?
thanks