BloombergLP::bslma::DeallocateBytesProctor

Proctor that deallocates a managed memory block upon destruction.

Synopsis

Declared in <bslma_deallocatebytesproctor.h>

template<class ALLOCATOR>
class DeallocateBytesProctor;

Description

This class implements a proctor that, unless its release method has previously been invoked, automatically deallocates a managed block of 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 block must have been provided by the supplied allocator (or pool); the allocator (or pool) must remain valid throughout the lifetime of the proctor object. If ALLOCATOR is a non-pointer type, it is assumed to be STL compatible; otherwise it is assumed have the same deallocation interface as bslma::Allocator.

Member Functions

NameDescription
DeallocateBytesProctor [constructor]Constructors
~DeallocateBytesProctor [destructor]Deallocate the managed memory, if any, without invoking any other destructors.
ptr Return the address of the currently managed memory block, if engaged; otherwise return a null pointer.
release Disengage this allocator and return a pointer to the formerly managed memory block.
reset Release the managed memory and reset this proctor to manage a different block.