std::pmr::polymorphic_allocator<T>::polymorphic_allocator
来自cppreference.com
< cpp | memory | polymorphic
allocator
动态内存管理
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::pmr::polymorphic_allocator
| 成员函数 | ||||
|
polymorphic_allocator::polymorphic_allocator
|
||||
|
(C++20
中弃用)
|
||||
| 非成员函数 | ||||
|
(C++20
前)
|
|
polymorphic_allocator()
noexcept;
|
(1) | |
|
polymorphic_allocator(
const
polymorphic_allocator&
other )
= default;
|
(2) | |
|
template<
class U
>
polymorphic_allocator( const polymorphic_allocator<U>& other ) noexcept; |
(3) | |
|
polymorphic_allocator(
memory_resource*
r);
|
(4) | |
构造新的 polymorphic_allocator 。
2-3) 以 other.resource() 为底层
memory_resource 构造
polymorphic_allocator 。4) 以
r 为底层
memory_resouce 构造 polymorphic_allocator 。此构造函数提供从
memory_resource* 的隐式转换。参数
| other | - | 要复制的另一 polymorphic_allocator
|
| r | - | 指向要使用的 memory_resource 的指针。不可为空。 |
异常
4) 不抛出任何异常。
注意
复制使用 polymorphic_allocator 的容器不会调用分配器的复制构造函数。新容器会替代地以
select_on_container_copy_construction
的返回值(默认构造的 polymorphic_allocator )为其分配器。
参阅
为容器的复制构造函数的使用创建一个新的 polymorphic_allocator (公开成员函数) |