Notice that a global function with the same name, swap, exists with the same behavior, and which acts as a specialization for strings of the algorithm function with the same name.
Parameters
- str
- a string object to swap its contents with those of the object.
Return value
noneExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Output:
Before swap, buyer has money and seller has goods After swap, buyer has goods and seller has money |
Basic template member declaration
( basic_string<charT,traits,Allocator> ) |
See also
| swap | Swap contents of two strings (function) |
| string::replace | Replace part of string (public member function) |
| string::assign | Assign content to string (public member function) |
