fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <cctype>
  5. #include <cstdlib>
  6. #include <fstream>
  7. #include <sstream>
  8. #include <list>
  9. #include <deque>
  10.  
  11.  
  12. int main()
  13. {
  14. std::list<int> nums = {1, 2, 3, 4, 5};
  15. auto &ref = nums;
  16.  
  17. nums.assign({1, 2, 3, 4, 5, 6, 7});
  18. for (auto &i : nums)
  19. std::cout << i << std::endl;
  20. }
  21.  
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
1
2
3
4
5
6
7