在线文档教程
C++
容器 | Containers

std::priority_queue::swap

科技促进发展:优先事项[医]队列::交换

void swap( priority_queue& other ) noexcept(/* see below */(since C++11)

将容器适配器的内容与other.有效地打电话usingstd::swap; swap(c, other.c swap(comp, other.comp

参数

other-container adaptor to exchange the contents with

返回值

%280%29

例外

In the noexcept expressions below, the identifier swap is looked up in the same manner as the C++17 std::is_nothrow_swappable trait. noexcept specification: noexcept(noexcept(swap(c, other.c)) && noexcept(swap(comp, other.comp)))(until C++17)
noexcept specification: noexcept(std::is_nothrow_swappable<Container>::value && std::is_nothrow_swappable<Compare>::value)(since C++17)

复杂性

与底层容器%28相同,通常为常数%29。

另见

std::swap(std::priority_queue)specializes the std::swap algorithm (function template)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/容器/优先级[医]队列/交换