Is it more efficient to copy a vector by reserving and copying, or by creating and swapping? [duplicate]

They aren’t the same though, are they? One is a copy, the other is a swap. Hence the function names.

My favourite is:

a = b;

Where a and b are vectors.

Leave a Comment