C++ extend a vector with another vector

Solution 1:

From here

// reserve() is optional - just to improve performance
v.reserve(v.size() + distance(v_prime.begin(),v_prime.end()));
v.insert(v.end(),v_prime.begin(),v_prime.end());

Solution 2:

copy(v_prime.begin(), v_prime.end(), back_inserter(v));