fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. struct Object { int x; Object(int x) { this->x = x; } };
  5.  
  6. int main() {
  7. std::vector<Object> v;
  8.  
  9. for (int i = 0; i < 5; i++)
  10. {
  11. v.push_back(Object(i));
  12. std::cout << &(v.back()) << std::endl; // Prints the address of the Object just added
  13. }
  14.  
  15. }
  16.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
0x8e66008
0x8e6601c
0x8e66030
0x8e66034
0x8e66050