Guard that unconditionally deallocates a managed memory block on destruction.

Synopsis

Declared in <bslma_deallocatorguard.h>

template<class ALLOCATOR>
class DeallocatorGuard;

Description

This class implements a guard that unconditionally 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 supplied by the allocator (or pool), which must remain valid throughout the lifetime of the guard object.

Member Functions

Name

Description

DeallocatorGuard [constructor]

Create a deallocator guard that manages the specified memory block.

~DeallocatorGuard [destructor]

Destroy this guard and deallocate its managed memory block.

Created with MrDocs