I have an STL list, and I want to move on it from back to front. I am trying to use the reverse_iterator, but I am getting a compilation error. Here is my code:
typedef std::list<RECT> RectList;
RectList myList; // The list is created and initialised elsewhere
for ( RectList::reverse_iterator ri = myList.rbegin();
ri != RectList.rend(); ++ri )
{
*ri = *(ri + 1);
}
I get the following errors in the last line: error C2784: 'class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> __cdecl std::operator +(_D,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce template argument for '' from 'class std::reverse_bidirectional_iterator<class std::list<struct tagRECT,class std::allocator<struct tagRECT> >::iterator,struct tagRECT,struct tagRECT &,struct tagRECT *,int>'
error C2676: binary '+' : 'class std::reverse_bidirectional_iterator<class std::list<struct tagRECT,class std::allocator<struct tagRECT> >::iterator,struct tagRECT,struct tagRECT &,struct tagRECT *,int>' does not define this operator or a conversion to a type acceptable to the predefined operator
Hosam Aly Mahmoud