I prefer two ways:
void copyVecFast(const vec<int>& original)
{
vector<int> newVec;
newVec.reserve(original.size());
copy(original.begin(),original.end(),back_inserter(newVec));
}
void copyVecFast(vec<int>& original)
{
vector<int> newVec;
newVec.swap(original);
}
How do you do it?