C++ templates error: instantiated from 'void TestClass::testMethod(T, std::map) [with T = SomeClass]
- by pureconsciousness
Hello there,
I've some problem in my code I cannot deal with:
#ifndef TESTCLASS_H_
#define TESTCLASS_H_'
#include <map>
using namespace std;
template <typename T>
class TestClass
{
public:
TestClass(){};
virtual ~TestClass(){};
void testMethod(T b,std::map<T,int> m);
};
template <typename T>
void TestClass`<T`>::testMethod(T b,std::map<T,int> m){
m[b]=0;
}
#endif /*TESTCLASS_H_*/
int main(int argc, char* argv[]) {
SomeClass s;
TestClass<SomeClass> t;
map<SomeClass,int> m;
t.testMethod(s,m);
}
Compiler gives me following error in line m[b]=0; :
instantiated from 'void TestClass::testMethod(T, std::map) [with T = SomeClass]
Could you help find the problem??
Thanks in advance