我有一个模板函数,其中有std::map::iterator
实例化 -
template <class B , class C>
C getValue (B& myMap , C returnType) {
map<string,C>::iterator it = myMap.find(var);
// implementation ...
}
它会提示错误-
In function ‘C getValue(char*, B&, C)’:
error: expected ‘;’ before ‘it’
error: ‘it’ was not declared in this scope
我应该如何正确地做到这一点?