stl:algorithm:swap

C++ Reference

swap

Syntax:

    #include <algorithm>
    void swap( Assignable& a, Assignable& b );

The swap() function swaps the values of a and b. swap() expects that its arguments will conform to the Assignable model; that is, they should have a copy constructor and work with the = operator. This function performs one copy and two assignments.

Related Topics: copy, copy_backward, copy_n, iter_swap, swap_ranges