I tried to do an excercise from Stroupstrup's book. The reader is asked to reverse the
order of elements in a vector so that if originally vector = 1, vector  = 2, and
vector = 3, then new vector has newvec = 3, newvec = 2, and newvec = 1.
Doing this through creating a new vector was straighforward. However, part b) of the
exercise requests the reader to reverse the elements WITHOUT creating a new vector.
I guess it means to reverse the elements of the original vector. Stroupstrup suggests
that the reader use the swap function to do this.
I researched the swap function and can't find any examples of it being used with ONE
vector. It is always used with two vectors as in
I thought that it might be used for swapping elements as in
first[i].swap(first[first.size() - 1 -i]);
But this gave me a memory allocation error.
This exercise is from the chapter (8) in which Stroustrup explains pass-by-reference.
I thought of trying to use pass-by-reference for swapping but I don't see how to formulate
How does one use the swap function to reverse the order of elements in a vector without
using any other vectors?