That might be a silly question, but I'm staring at this code for a while and can't think of what's wrong. On compiling:
#include
#include
I get:
foo.cpp:8: error: template declaration of ‘bool add_to_string_map’
foo.cpp:8: error: expected ‘)’ before ‘map’
foo.cpp:8: error: expected primary-expression before ‘str’
foo.cpp:8: error: expected primary-expression before ‘x’
(Definition of my_string_map class was taken from another thread of this forum)
When i specialize what template type I'm using, like in
bool add_to_string_int_map(my_string_map::type map,
std::string str, int x) {
if (map.find(str) != map.end())
return false;
map[str] = x;
return true;
}
everything works fine. Why it's not working and/or how to get it working?
Thanks in advance for your help
No comments:
Post a Comment