BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslma::DeallocatorGuard< ALLOCATOR > Class Template Reference

#include <bslma_deallocatorguard.h>

Public Member Functions

 DeallocatorGuard (void *memory, ALLOCATOR *allocator)
 
 ~DeallocatorGuard ()
 

Detailed Description

template<class ALLOCATOR>
class bslma::DeallocatorGuard< ALLOCATOR >

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.

See bslma_deallocatorguard

Constructor & Destructor Documentation

◆ DeallocatorGuard()

template<class ALLOCATOR >
bslma::DeallocatorGuard< ALLOCATOR >::DeallocatorGuard ( void *  memory,
ALLOCATOR *  allocator 
)
inline

Create a deallocator guard that unconditionally manages the specified memory block, and that uses the specified allocator to deallocate memory upon destruction of this guard. The behavior is undefined unless memory and allocator are non-zero, and allocator supplied memory. Note that allocator must remain valid throughout the lifetime of this guard.

◆ ~DeallocatorGuard()

template<class ALLOCATOR >
bslma::DeallocatorGuard< ALLOCATOR >::~DeallocatorGuard ( )
inline

Destroy this deallocator guard and deallocate the block of memory it manages by invoking the deallocate method of the allocator (or pool) that was supplied with the address of the (managed) memory at construction.


The documentation for this class was generated from the following file: