fork download
  1. #include <string>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. string DoSomething(vector<string*>::iterator a) {
  8. string* entry = *a;
  9. cout << *entry << endl;
  10. return "blah";
  11. }
  12.  
  13. int main() {
  14. vector<string*> added;
  15. string v1 = "v1";
  16. string v2 = "v2";
  17.  
  18. added.push_back(&v1);
  19. added.push_back(&v2);
  20.  
  21. vector<string*>::iterator it;
  22.  
  23. for (it = added.begin(); it < added.end(); it++) {
  24. string value = DoSomething(it);
  25. }
  26. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
v1
v2