BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslma::DefaultAllocatorGuard Class Reference

#include <bslma_defaultallocatorguard.h>

Public Member Functions

 DefaultAllocatorGuard (Allocator *temporary)
 
 ~DefaultAllocatorGuard ()
 

Detailed 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.

See bslma_defaultallocatorguard

Constructor & Destructor Documentation

◆ DefaultAllocatorGuard()

bslma::DefaultAllocatorGuard::DefaultAllocatorGuard ( Allocator temporary)
explicit

Create a scoped guard that installs the specified temporary allocator as the default allocator. Note that the default allocator is automatically restored to the original allocator on destruction.

◆ ~DefaultAllocatorGuard()

bslma::DefaultAllocatorGuard::~DefaultAllocatorGuard ( )

Restore the default allocator that was in place when this scoped guard was created and destroy this guard.


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