fork download
  1. #include <cstdio>
  2. #include <vector>
  3. class Person{
  4. public:
  5. int age;
  6. int weight;
  7. Person(int age, int weight):age(age), weight(weight){}
  8. };
  9. int main() {
  10. std::vector<Person> ls;
  11. Person p(33, 44);
  12. ls.push_back(p);
  13. ls.push_back(p);
  14. ls.push_back(p);
  15. for(auto i=ls.begin();i!=ls.end();++i){
  16. printf("%X %X %d %d\n", i, &(*i), (*i).age, (*i).weight);
  17. }
  18.  
  19. }
Success #stdin #stdout 0s 2984KB
stdin
Standard input is empty
stdout
8571030 8571030 33 44
8571038 8571038 33 44
8571040 8571040 33 44