I am trying to iterate over a map defined as follows:
std::map< size_type, std::pair<size_t, unsigned int> > ridx_;
Now I am trying to iterate through ridx_ (which is a private member of the class) in the next friend function, which overloads operator <<
std::ostream& operator<<(std::ostream &os, const SMatrix &m) { std::map< size_type, std::pair<size_t, unsigned int> >::iterator it;
However g ++ errors with:
SMatrix.cpp: 34: error: no match for 'operator =' in 'it = m-> SMatrix :: ridx_.std :: map <_Key, _Tp, _Compare, _Alloc> :: start with _Key = unsigned int, _Tp = std :: pair, _Compare = std :: less, _Alloc = std :: allocator → '/usr/include/c++/4.3/bits/stl_tree.h:152: note: candidates: std :: _ Rb_tree_iterator → & std :: _ Rb_tree_iterator → :: operator = (const std :: _ Rb_tree_iterator → &) make: * [myTest] Error 1
What am I doing wrong?
source share