fork(1) download
  1. #include <iostream>
  2. #include <list>
  3.  
  4.  
  5. int main()
  6. {
  7. std::list<int> a = { 10 };
  8.  
  9. auto it = std::prev(a.begin());
  10.  
  11. std::list<int> b;
  12.  
  13. b.splice(b.begin(), a);
  14.  
  15. a.push_back(12);
  16.  
  17. std::cout << *std::next(it);
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
12