Create a deallocator guard that manages the specified memory block.

Synopsis

Declared in <bslma_deallocatorguard.h>

DeallocatorGuard(
    void* memory,
    ALLOCATOR* allocator);

Description

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.

Parameters

Name

Description

memory

The address of the memory block to manage.

allocator

The allocator used to deallocate the managed memory.

Created with MrDocs