list-rbegin

////////////////////////////////////////
//      2018/04/26 14:16:15
//      list-rbegin

// returns a reverse iterator to the beginning of the list
#include <iostream>
#include <list>
#include <algorithm>
#include <numeric>
#include <iterator>

using namespace std;

int main(){
    list<int> l(10);
    iota(l.begin(), l.end(), 1);
    copy(l.begin(), l.end(), ostream_iterator<int>(cout," "));
    cout << endl;

    list<int>::reverse_iterator it = l.rbegin();
    while (it != l.rend()){
        cout << *(it++) << " ";
    }
    cout << endl;

    return 0;
}

/*
OUTPUT:
    1 2 3 4 5 6 7 8 9 10
    10 9 8 7 6 5 4 3 2 1
*/
原文地址:https://www.cnblogs.com/laohaozi/p/12537945.html