Possible Duplicate:
Where and why do I have to put the “template” and “typename” keywords?
map iterator in template function unrecognized by compiler
I have a template function which has std::map::iterator
instantiation within it -
template <class B , class C>
C getValue (B& myMap , C returnType) {
map<string,C>::iterator it = myMap.find(var);
// implementation ...
}
and it prompt errors -
In function ‘C getValue(char*, B&, C)’:
error: expected ‘;’ before ‘it’
error: ‘it’ was not declared in this scope
How should I have make it properly ?