How to access the 'previous' element in a C++ list iterator loop?

I'm trying to access the previously iterated element in a loop going through all the elements of a list.

To be more specific, my loop looks like this:

for (iter=list_object.begin(); iter!= list_object_.end(); iter++)
  {
    function_1(*iter);
    function_2(*PREVIOUS_VALUE_IN_THE_LIST);
  }

How do I access this previous value in the list?

13
задан morgoth_bauglir 7 April 2011 в 19:17
поделиться