[#BloombergLP-bslma-DefaultAllocatorGuard] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::DefaultAllocatorGuard :relfileprefix: ../../ :mrdocs: This class provides a scoped guard that temporarily replaces the process‐wide default allocator. == Synopsis Declared in `<bslma_defaultallocatorguard.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslma/DefaultAllocatorGuard/2constructor.adoc[`DefaultAllocatorGuard`] [.small]#[constructor]# | Create a scoped guard that installs the specified temporary allocator. | xref:BloombergLP/bslma/DefaultAllocatorGuard/2destructor.adoc[`~DefaultAllocatorGuard`] [.small]#[destructor]# | Restore the default allocator that was in place when this scoped guard was created and destroy this guard. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#