Class template resource_adaptor_imp
boost::container::pmr::resource_adaptor_imp
Synopsis
Description
Пример resource_adaptor представляет собой адаптер, который обертывает интерфейс memory_resource вокруг Allocator. Чтобы ресурс_adaptor> и ресурс_adaptor> были одного и того же типа для любого шаблона распределителя X и типов T и U, ресурс_adaptor отображается как псевдоним для этого шаблона класса таким образом, что Allocator восстанавливается к типу значения char в каждой специализации шаблона класса. Требования к этому шаблону классов определены ниже. В дополнение к требованиям Allocator параметр resource_adaptor должен соответствовать следующим дополнительным требованиям:
resource_adaptor_imp
public
construct/copy/destruct
resource_adaptor_imp();
Effects: Default constructs m_alloc.
resource_adaptor_imp(const resource_adaptor_imp & other);
Effects: Copy constructs m_alloc.
Effects: Переместить конструкции m_alloc.
Effects: Move constructs m_alloc.
[ORIG_END] -->explicit resource_adaptor_imp(const Allocator & a2);
Effects: Initializes m_alloc with a2.
explicit resource_adaptor_imp(Allocator && a2);
Effects: Initializes m_alloc with a2.
Effects: Копировать присваивает m_alloc.
Effects: Copy assigns m_alloc.
[ORIG_END] -->Effects: Переместить присваивает m_alloc.
Effects: Move assigns m_alloc.
[ORIG_END] -->
resource_adaptor_imp
public member functions
allocator_type & get_allocator();
Effects: Returns m_alloc. const allocator_type & get_allocator() const;
Effects: Returns m_alloc.
resource_adaptor_imp
protected member functions
Returns: Выделенная память, полученная путем вызова m_alloc.allocate. Размер и выравнивание распределенной памяти должны соответствовать требованиям для класса, полученного из memory_resource
.
Returns: Allocated memory obtained by calling m_alloc.allocate. The size and alignment of the allocated memory shall meet the requirements for a class derived from memory_resource
.
[ORIG_END] -->virtual void do_deallocate(void * p, size_t bytes, size_t alignment);
Requires: p was previously allocated using A.allocate, where A == m_alloc, and not subsequently deallocated.
Effects: Returns memory to the allocator using m_alloc.deallocate().
virtual bool do_is_equal(const memory_resource & other) const noexcept;
Let p be dynamic_cast<const resource_adaptor_imp*>(&other).
Returns: false if p is null, otherwise the value of m_alloc == p->m_alloc.