1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
// unordered_multiset::swap
#include <iostream>
#include <string>
#include <unordered_set>
int main ()
{
std::unordered_multiset<std::string>
first = {"cow","chicken","pig","pig"},
second = {"wolf","rabbit","rabbit"};
first.swap(second);
std::cout << "first:";
for (const std::string& x: first) std::cout << " " << x;
std::cout << std::endl;
std::cout << "second:";
for (const std::string& x: second) std::cout << " " << x;
std::cout << std::endl;
return 0;
}
| |