首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::forward_list::swap

void swap( forward_list& other );

(since C++11) (until C++17)

void swap( forward_list& other ) noexcept(/* see below */);

(since C++17)

将容器的内容与other不对单个元素调用任何移动、复制或交换操作。

所有迭代器和引用仍然有效。未指定保存此容器中的过去端值的迭代器将在操作后引用此容器还是其他容器。

If std::allocator_traits<allocator_type>::propagate_on_container_swap::value is true, then the allocators are exchanged using an unqualified call to non-member swap. Otherwise, they are not swapped (and if get_allocator() != other.get_allocator(), the behavior is undefined).

(since C++11)

参数

other

-

container to exchange the contents with

返回值

%280%29

例外

(none).

(until C++17)

noexcept specification: noexcept(std::allocator_traits<Allocator>::is_always_equal::value)

(since C++17)

复杂性

常量。

另见

std::swap(std::forward_list) (C++11)

specializes the std::swap algorithm (function template)

代码语言:txt
复制
 © cppreference.com

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

扫码关注腾讯云开发者

领取腾讯云代金券