std::pmr::polymorphic_allocator::polymorphic_allocator - cppreference.com (original) (raw)
| 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 new polymorphic_allocator.
- Constructs a
polymorphic_allocatorusing the return value of std::pmr::get_default_resource() as the underlying memory resource.
2,3) Constructs a polymorphic_allocator using other.resource() as the underlying memory resource.
- Constructs a
polymorphic_allocatorusing r as the underlying memory resource. This constructor provides an implicit conversion from std::pmr::memory_resource*.
[edit] Parameters
| other | - | another polymorphic_allocator to copy from |
|---|---|---|
| r | - | pointer to the memory resource to use. May not be null |
[edit] Exceptions
- Throws nothing.
[edit] Notes
Copying a container using a polymorphic_allocator will not call the allocator's copy constructor. Instead, the new container will use the return value of [select_on_container_copy_construction](select%5Fon%5Fcontainer%5Fcopy%5Fconstruction.html "cpp/memory/polymorphic allocator/select on container copy construction") (a default-constructed polymorphic_allocator) as its allocator.