|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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) | |
Constructs a newpolymorphic_allocator.
polymorphic_allocator using the return value ofstd::pmr::get_default_resource() as the underlying memory resource.polymorphic_allocator usingother.resource() as the underlying memory resource.polymorphic_allocator usingr as the underlying memory resource. This constructor provides an implicit conversion fromstd::pmr::memory_resource*.Contents |
| other | - | anotherpolymorphic_allocator to copy from |
| r | - | pointer to the memory resource to use. May not be null |
Copying a container using apolymorphic_allocator will not call the allocator's copy constructor. Instead, the new container will use the return value ofselect_on_container_copy_construction (a default-constructedpolymorphic_allocator) as its allocator.
create a newpolymorphic_allocator for use by a container's copy constructor(public member function)[edit] |