I am unable to define a map with my own class as the value type. This is exactly what I am trying:
myfile.cpp
class myclass
{
public:
myclass() {}
myclass(const myclass &m):y(m.y){}
~myclass() {}
int y;
};
int main()
{
...
std::map<std:string, myclass> funcmap;
...
}
This does not compile:
g++ myfile.cpp
myfile.cpp:46:33: error: wrong number of template arguments (1, should be 4)
/usr/include/c++/4.6/bits/stl_map.h:88:11: error: provided for âtemplate<class _Key, class _Tp, class _Compare, class _Alloc> class std::mapâ
I don't get this error if I use an int or string in the place of myclass in the map declaration.