Hi guys, as the title states, I'm having some trouble going through a map of maps and printing out all of the values. Here is my declaration of the map:
And here is my Display function:Code:map<T, map<T, int> > adjList;
When I try to compile this, I get the follow error:Code:template<typename T> void Graph<T>::display() const { map<T, map<T, int> >::iterator iter; for (iter = adjList.begin(); iter != adjList.end(); ++iter) { cout << iter->first << endl; map<T, int>::iterator pos; for (pos = adjList[iter->first].begin(); pos != adjList[iter->first].end(); ++pos) { cout << pos->first << " " << pos->second << endl; } } }
I'm pretty new to using iterators for this type of thing, and completely new to maps as well. Any help would be appreciated.Code:error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::_Tree_const_iterator<_Mytree>' (or there is no acceptable conversion)



LinkBack URL
About LinkBacks




I used to be an adventurer like you... then I took an arrow to the knee.