std::indirect<T, Allocator>:: swap
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
constexpr
void
swap
(
indirect
&
other
)
noexcept
(
/* see below */
)
;
|
(自 C++26 起) | |
与 other 交换内容。
在以下描述中, swap_allocators 指代 std:: allocator_traits < Allocator > :: propagate_on_container_swap :: value 。
交换 * this 与 other 的状态,互换所拥有的对象或无值状态。
-
若
swap_allocators
为
true
,则执行
using
std::
swap
;
swap (alloc , other.alloc ) ; 。 - 否则,分配器不会被交换。
若满足以下任一条件,则行为未定义:
-
当
swap_allocators
为
true
,且
Allocator不满足 Swappable 要求时。 - 当 swap_allocators 为 false ,且 get_allocator ( ) == other. get_allocator ( ) 为 false 时。
目录 |
参数
| 其他 | - |
用于交换内容的
indirect
对象
|
异常
|| std:: allocator_traits < Allocator > :: is_always_equal :: value )
示例
|
本节内容不完整
原因:缺少示例 |
参见
|
(C++26)
|
特化
std::swap
算法
(函数模板) |