fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. struct Character { string name; };
  8.  
  9. template<typename T>
  10. using Array = vector<T>;
  11.  
  12. #define add push_back
  13.  
  14. auto copy_string(const char* s) { return string(s); }
  15.  
  16. int main() {
  17. Array<Character*> people;
  18.  
  19. [&people] {
  20. auto character = new Character();
  21. character->name = copy_string("Larry");
  22. people.add(character);
  23. }();
  24.  
  25. cout << people[0]->name << endl;
  26. delete people[0];
  27. }
  28.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
Larry