BDE 4.14.0 Production release
|
#include <bslma_deallocatorproctor.h>
Public Member Functions | |
DeallocatorProctor (void *memory, ALLOCATOR *allocator) | |
~DeallocatorProctor () | |
void | release () |
void | reset (void *memory) |
This class implements a proctor that, unless its release
method has previously been invoked, automatically deallocates a block of managed memory upon destruction by invoking the deallocate
method of an allocator (or pool) of parameterized ALLOCATOR
type supplied to it at construction. The managed memory must have been provided by this allocator (or pool), which must remain valid throughout the lifetime of the proctor object.
|
inline |
Create a deallocator proctor that conditionally manages the specified memory
(if non-zero), and that uses the specified allocator
to deallocate the block of memory managed by this proctor (if not released – see release
) upon destruction. The behavior is undefined unless allocator
is non-zero and supplied memory
. Note that allocator
must remain valid throughout the lifetime of this proctor.
|
inline |
Destroy this deallocator proctor, and deallocate the block of memory it manages (if any) by invoking the deallocate
method of the allocator (or pool) that was supplied at construction of this proctor. If no memory is currently being managed, this method has no effect.
|
inline |
Release from management the block of memory currently managed by this proctor. If no memory is currently being managed, this method has no effect.
|
inline |
Set the specified memory
as the block of memory to be managed by this proctor. The behavior is undefined unless memory
is non-zero and was allocated by the allocator (or pool) supplied at construction. Note that this method releases any previously-managed memory from management (without deallocating it), and so may be invoked with or without having called release
when reusing this object.