fork download
  1. #include <iostream>
  2. #include <list>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. list<int> l{1,2,3,4,5};
  10.  
  11. for(auto itr = l.begin(), end = std::prev(l.end()); itr != end; ++itr)
  12. {
  13. cout << *itr << '\n';
  14. }
  15. }
  16.  
Success #stdin #stdout 0s 4168KB
stdin
Standard input is empty
stdout
1
2
3
4