////////////////////////////////////////
// 2018/04/26 8:39:49
// list-pop_back
// removes the last element
#include <iostream>
#include <list>
#include <algorithm>
#include <numeric>
#include <iterator>
using namespace std;
int main(){
list<int> l(5);
iota(l.begin(),l.end(),1);
copy(l.begin(), l.end(), ostream_iterator<int>(cout, " "));
cout << endl;
while (!l.empty()){
l.pop_back();
copy(l.begin(),l.end(),ostream_iterator<int>(cout," "));
cout << endl;
}
return 0;
}
/*
OUTPUT:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
*/