This question made me uncertain about appending a vector to itself. So the question is: Following lines of code do what I expect, but is it standard conform?
vec.reserve(vec.size() * 2):
vec.insert(vec.end(), vec.begin(), vec.end());
Following (without reserve()
) still works, is it even standard conform?
vec.insert(vec.end(), vec.begin(), vec.end());
Or implementation depending?
See Question&Answers more detail:os