![]() |
VOOZH | about |
The unordered_multiset::swap() is a built-in function in C++ STL which swaps the contents of two unordered_multiset
containers.
Note: Both of the containers should have the same type of elements. Sizes of the containers may differ.
Syntax:
unordered_multiset1.swap(unordered_multiset2);
Parameters: The function accepts only one compulsory parameter i.e unordered_multiset2 with which the swapping of unordered_multiset1 is to be done.
Return Value: It does not return any value.
Below programs illustrate the above function.
Program 1:
Initial values of s1 are: 4 3 2 1 Initial values of s2 are: 50 40 30 20 10 Final values of s1 are: 50 40 30 20 10 Final values of s2 are: 4 3 2 1
Program 2:
Initial values of s1 are: for Geeks Geeks Initial values of s2 are: Geeks for Portal Science Computer Final values of s1 are: Geeks for Portal Science Computer Final values of s2 are: for Geeks Geeks