BloombergLP::bslma::DefaultAllocatorGuard

This class provides a scoped guard that temporarily replaces the process-wide default allocator.

Synopsis

Declared in <bslma_defaultallocatorguard.h>

class DefaultAllocatorGuard;

Description

Upon construction, an object of this class saves the current default allocator and installs the user-specified allocator as the default allocator. On destruction, the original default allocator is restored. Objects of this class are intended for testing purposes only and are not guaranteed to be safe in production environments.

Member Functions

NameDescription
DefaultAllocatorGuard [constructor]Create a scoped guard that installs the specified temporary allocator.
~DefaultAllocatorGuard [destructor]Restore the default allocator that was in place when this scoped guard was created and destroy this guard.