After the call to this member function, the elements in this container are those which were in st before the call, and the elements of st are those which were in this. All iterators, references and pointers remain valid for the swapped objects.
Notice that a global algorithm function exists with this same name, swap, and the same behavior.
Parameters
- st
- Another set container of the same type as this whose content is swapped with that of this container.
Return value
noneExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Output:
first contains: 20 25 32 second contains: 10 12 75 |
Complexity
Constant.See also
| swap | Exchange values of two objects (function template) |
