You pass your std::vectoras a value. To change std::vector, you go to the function, declare it as a link
void replace(vector<string>& my_vector_2, string old, string replacement){ }
&means that you pass your std::vectorby reference and you can access the object you passed.
And do not erase the item, just replace it.
source
share