fork(1) download
  1. #include <list>
  2. #include <iostream>
  3. #include <ostream>
  4.  
  5. class Foo
  6. {
  7. public:
  8. Foo(int x_ = -1) : x(x_), y(-2.3f) {}
  9. int x;
  10. float y;
  11. };
  12.  
  13. int main()
  14. {
  15. std::list<int> myList;
  16. myList.push_back(0);
  17. for (auto it = std::begin(myList); it != std::end(myList); ++it)
  18. {
  19. Foo const& c = *it;
  20. std::cout << c.x << ' ' << c.y << std::endl;
  21. // output: 0 -2.3
  22. }
  23. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
0 -2.3