void swap (queue& x) noexcept(/*see below*/);
*this
noexcept
1234567891011121314151617
// queue::swap #include <iostream> // std::cout #include <queue> // std::queue int main () { std::queue<int> foo,bar; foo.push (10); foo.push(20); foo.push(30); bar.push (111); bar.push(222); foo.swap(bar); std::cout << "size of foo: " << foo.size() << '\n'; std::cout << "size of bar: " << bar.size() << '\n'; return 0; }
size of foo: 2 size of bar: 3