How do you iterate backwards through an STL list?

前端 未结 5 1873
眼角桃花
眼角桃花 2020-12-08 09:25

I\'m writing some cross-platform code between Windows and Mac.

If list::end() \"returns an iterator that addresses the location succeeding the last element in a list

5条回答
  •  伪装坚强ぢ
    2020-12-08 10:12

    This should work:

    list::reverse_iterator iter = m_Objs.rbegin();
    for (; iter!= m_Objs.rend(); iter++)
    {
    }
    

提交回复
热议问题