Hacker News new | ask | show | jobs
by pjmlp 1749 days ago
Ah ok, although for the audience not versed in C++ the correct code is,

  void foo(std::vector<int> *ref) {
    ref->push_back(4); 
  }
  foo(&v);
or

  void foo(std::vector<int> &ref) {
    ref.push_back(4); 
  }
  foo(v);
1 comments

Oops, right, bit rusty on C++...