std::polymorphic<T, Allocator>::get_allocator
来自cppreference.com
< cpp | memory | polymorphic
constexpr void swap( polymorphic& other ) noexcept(/* 见下文 */); | (C++26 起) | |
与 other 交换内容。
在以下描述中,以 swap_allocators 指代 std::allocator_traits<Allocator>::propagate_on_container_swap::value。
交换 *this 与 other 的状态:交换拥有的对象或无值状态。
如果满足以下任一条件,那么行为未定义:
- swap_allocators 是 true,并且
Allocator
不满足可交换 (Swappable) 的要求。 - swap_allocators 是 false,并且 get_allocator() == other.get_allocator() 是 false。
目录 |
[编辑] 参数
other | - | 要与之交换内容的 polymorphic 对象 |
[编辑] 异常
noexcept 说明:
noexcept(std::allocator_traits<Allocator>::propagate_on_container_swap::value
|| std::allocator_traits<Allocator>::is_always_equal::value)
|| std::allocator_traits<Allocator>::is_always_equal::value)
[编辑] 示例
本节未完成 原因:暂无示例 |
[编辑] 参阅
(C++26) | 特化 std::swap 算法 (函数模板) |