#include <vector> void swap( container& from );
The swap() function exchanges the elements of the current vector with those of from. This function operates in constant time.
For example, the following code uses the swap() function to exchange the contents of two vectors:
The above code displays:
The first element in v1 is And I'm in v2! The first element in v2 is I'm in v1!