list-reverse

////////////////////////////////////////
//      2018/04/27 7:17:47
//      list-reverse

#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;

    l.reverse();
    copy(l.begin(),l.end(), ostream_iterator<int>(cout, " "));
    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/12537938.html