1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// swap queues
#include <iostream> // std::cout
#include <queue> // std::queue, std::swap(queue)
int main ()
{
std::queue<int> foo,bar;
foo.push (10); foo.push(20); foo.push(30);
bar.push (111); bar.push(222);
swap(foo,bar);
std::cout << "size of foo: " << foo.size() << '\n';
std::cout << "size of bar: " << bar.size() << '\n';
return 0;
}
|