Map <T, T> :: iterator as parameter type
I have a template class with a private card member
template <typename T> class MyClass { public: MyClass(){} private: std::map<T,T> myMap; } I would like to create a private method that takes an iterator to the map
void MyFunction(std::map<T,T>::iterator &myIter){....} However, this leads to a compilation error: the identifier is 'iterator'. I do not need to pass an abstract iterator, since MyFunction knows that it is a map iterator (and will only be used as interator for myMap) and will consider it as such (access and change myIter-> second). Passing myIter-> second to MyFunction is not enough, since MyFunction should also be able to ++ myIter ;.
+4
3 answers