1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
// unordered_set::swap
#include <iostream>
#include <string>
#include <unordered_set>
int main ()
{
std::unordered_set<std::string>
first = {"iron","copper","oil"},
second = {"wood","corn","milk"};
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;
}
| |