fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. struct cmStateSnapshot {
  6. int i;
  7. cmStateSnapshot(int i) : i(i) { }
  8. std::vector<cmStateSnapshot> GetChildren() {
  9. return {1, 2, 3, 4, 5, 6};
  10. }
  11. };
  12.  
  13. struct Lg {
  14. cmStateSnapshot GetStateSnapshot() const {
  15. return {1};
  16. }
  17. };
  18.  
  19. int main() {
  20. Lg* lg = new Lg;
  21. for (cmStateSnapshot const& state : lg->GetStateSnapshot().GetChildren()) {
  22. std::cout << state.i << std::endl;
  23. }
  24. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
1
2
3
4
5
6