fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. std::vector<std::string> get_name_list()
  6. {
  7. std::string name1 = "foo";
  8. std::string name2 = "bar";
  9.  
  10. std::vector<std::string> names;
  11. names.push_back(name1);
  12. names.push_back(name2);
  13. return names;
  14. }
  15.  
  16. int main()
  17. {
  18. std::vector<std::string> list;
  19. list = get_name_list(); // deep copy strings? or access local memory?
  20. }
  21.  
  22.  
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
Standard output is empty