1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
// swap (multiset overload)
#include <iostream>
#include <set>
main ()
{
int myints[]={12,75,12,35,20,35};
std::multiset<int> first (myints,myints+3); // 12,12,75
std::multiset<int> second (myints+3,myints+6); // 20,35,35
swap(first,second);
std::cout << "first contains:";
for (std::multiset<int>::iterator it=first.begin(); it!=first.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
std::cout << "second contains:";
for (std::multiset<int>::iterator it=second.begin(); it!=second.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
return 0;
}
|