std::pmr::polymorphic_allocator<T>:: polymorphic_allocator
From cppreference.net
<
cpp
|
memory
|
polymorphic allocator
C++
Memory management library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::pmr::polymorphic_allocator
| Member functions | ||||
|
polymorphic_allocator::polymorphic_allocator
|
||||
|
(
C++20/26*
)
|
||||
| Non-member functions | ||||
|
(until 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
(
std::
pmr
::
memory_resource
*
r
)
;
|
(4) | |
构造一个新的
polymorphic_allocator
。
2,3)
使用
other.
resource
(
)
作为底层内存资源来构造一个
polymorphic_allocator
。
目录 |
参数
| other | - |
用于复制的另一个
polymorphic_allocator
|
| r | - | 指向要使用的内存资源的指针。不可为空 |
异常
4)
不抛出任何异常。
注释
使用
polymorphic_allocator
复制容器时不会调用分配器的拷贝构造函数。相反,新容器将使用
select_on_container_copy_construction
的返回值(一个默认构造的
polymorphic_allocator
)作为其分配器。
参见
为容器的拷贝构造函数创建新的
polymorphic_allocator
(公开成员函数) |