std::experimental::pmr::resource_adaptor, std::pmr::experimental::resource_adaptor
<experimental/memory_resource>
using resource_adaptor = /*resource-adaptor-imp*/<
typename std::allocator_traits <Alloc>::
class /*resource-adaptor-imp*/ : public memory_resource; // for exposition only
The alias template resource_adaptor adapts the allocator type Alloc with a memory_resource interface. The allocator is rebound to a char value type before it is actually adapted (using the resource-adaptor-imp class template), so that adapting specializations of the same allocator template always yields the same type, regardless of the value type the allocator template is originally instantiated with.
resource_adaptor is defined in namespace std::experimental::pmr, and the base type memory_resorce in this page is std::experimental::pmr::memory_resource .
(until library fundamentals TS v3)
resource_adaptor is defined in namespace std::pmr::experimental, and the base type memory_resorce in this page is std::pmr::memory_resource .
resource-adaptor-imp is a class template whose members are described below. The name resource-adaptor-imp is for exposition purposes only and not normative.
In addition to meeting the Allocator requirements, Alloc must additionally satisfy the following requirements:
- std::allocator_traits <Alloc>::pointer shall be identical to Alloc::value_type*.
- std::allocator_traits <Alloc>::const_pointer shall be identical to Alloc::value_type const*.
- std::allocator_traits <Alloc>::void_pointer shall be identical to void*.
- std::allocator_traits <Alloc>::const_const_pointer shall be identical to void const*.
[edit] Member types of resource-adaptor-imp
allocator_type
Alloc
[edit] Member functions of resource-adaptor-imp
resource-adaptor-imp::resource-adaptor-imp
= default;
= default;
other.other.a2.Parameters
resource-adaptor-imp object to copy or move from
Alloc object to copy or move from
resource-adaptor-imp::get_allocator
Returns a copy of the wrapped allocator.
resource-adaptor-imp::operator=
= default;
Defaulted copy assignment operator. Copy assigns the wrapped allocator from that of other.
resource-adaptor-imp::do_allocate
virtual void* do_allocate(std::size_t bytes, std::size_t alignment);
Allocates memory using the allocate member function of the wrapped allocator.
resource-adaptor-imp::do_deallocate
virtual void do_deallocate(void *p, std::size_t bytes, std::size_t alignment);
Deallocates the storage pointed to by p using the deallocate member function of the wrapped allocator.
p must have been allocated using the allocate member function of an allocator that compares equal to the wrapped allocator, and must not have been subsequently deallocated.
resource-adaptor-imp::do_is_equal
virtual bool do_is_equal(const memory_resource& other) const noexcept;
Let p be dynamic_cast<const /*resource-adaptor-imp*/*>(&other). If p is a null pointer value, returns false. Otherwise, return the result of comparing the allocators wrapped by *p and *this using operator==.