swap function template — Swaps two values
template<typename T> void swap(T& a, T& b);
The swap
function template
swaps the values of a
and
b
.
The standard containers all specialize the swap
template to call their swap
member functions, which usually run
in constant time, regardless of the number of elements in the
containers.