![]() |
Home | Libraries | People | FAQ | More |
boost::container::pmr::memory_resource
// In header: <boost/container/pmr/memory_resource.hpp> class memory_resource { public: // construct/copy/destruct ~(); // public member functions void * (, = ); void (void *, , = ); bool (const memory_resource &) ; // friend functions bool (const memory_resource &, const memory_resource &) ; bool (const memory_resource &, const memory_resource &) ; // protected member functions void * (, ) = ; void (void *, , ) = ; bool (const memory_resource &) ; // public data members static constexpr max_align; };
The memory_resource class is an abstract interface to an unbounded set of classes encapsulating memory resources.
memory_resource
public member functionsvoid * ( bytes, alignment = );
Effects: Equivalent to return do_allocate(bytes, alignment);
void (void * p, bytes, alignment = );
Effects: Equivalent to return do_deallocate(bytes, alignment);
bool (const memory_resource & other) ;
Effects: Equivalent to return do_is_equal(other);
memory_resource
friend functionsbool (const memory_resource & a, const memory_resource & b) ;
Returns: &a == &b || a.is_equal(b)
.
bool (const memory_resource & a, const memory_resource & b) ;
Returns: !(a == b).
memory_resource
protected member functionsvoid * ( bytes, alignment) = ;
Requires: Alignment shall be a power of two.
Returns: A derived class shall implement this function to return a pointer to allocated storage with a size of at least bytes. The returned storage is aligned to the specified alignment, if such alignment is supported; otherwise it is aligned to max_align.
Throws: A derived class implementation shall throw an appropriate exception if it is unable to allocate memory with the requested size and alignment.
void (void * p, bytes, alignment) = ;
Requires: p shall have been returned from a prior call to allocate(bytes, alignment)
on a memory resource equal to *this, and the storage at p shall not yet have been deallocated.
Effects: A derived class shall implement this function to dispose of allocated storage.
Throws: Nothing.
bool (const memory_resource & other) ;
Returns: A derived class shall implement this function to return true if memory allocated from this can be deallocated from other and vice-versa; otherwise it shall return false. [Note: The most-derived type of other might not match the type of this. For a derived class, D, a typical implementation of this function will compute dynamic_cast<const D*>(&other)
and go no further (i.e., return false) if it returns nullptr. - end note].