Przejdź do głównej zawartości

std::queue swap()

// Non const version only
void swap( queue& other ) noexcept(/* see below*/);

Exchanges the contents of the container adaptor with those of other.

zanotuj

Effectively does:

using std::swap;
swap(c, other.c);

Parameters

  • other - container adaptor to exchange the contents with

Return valued

(none)

Exceptions

noexcept specification:

noexcept(std::is_nothrow_swappable_v<Container>)

Complexity

Equivalent to that of swap of the underlying container.

zanotuj

For standard containers the complexity is guaranteed to be:

  • Linear in the size of the container - O(size()), for std::array.
  • Constant - O(1), for all other containers.

Notes

Some implementations (e.g. libc++) provide the swap member function as an extension to pre-C++11 modes.

Example

important

This section requires improvement. You can help by editing this doc page.

std::queue swap()

// Non const version only
void swap( queue& other ) noexcept(/* see below*/);

Exchanges the contents of the container adaptor with those of other.

zanotuj

Effectively does:

using std::swap;
swap(c, other.c);

Parameters

  • other - container adaptor to exchange the contents with

Return valued

(none)

Exceptions

noexcept specification:

noexcept(std::is_nothrow_swappable_v<Container>)

Complexity

Equivalent to that of swap of the underlying container.

zanotuj

For standard containers the complexity is guaranteed to be:

  • Linear in the size of the container - O(size()), for std::array.
  • Constant - O(1), for all other containers.

Notes

Some implementations (e.g. libc++) provide the swap member function as an extension to pre-C++11 modes.

Example

important

This section requires improvement. You can help by editing this doc page.