[#BloombergLP-bslma-ExceptionGuard]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::ExceptionGuard
:relfileprefix: ../../
:mrdocs:

This class provide a mechanism to verify the strong exception guarantee in exception&hyphen;throwing code&period; On construction, this class stores the a copy of an object of the parameterized type `OBJECT` and the address of that object&period; On destruction, if `release` was not invoked, it will verify the value of the object is the same as the value of the copy create on construction&period; This class requires the copy constructor and `operator &equals;&equals;` to be tested before use&period;

== Synopsis

Declared in `&lt;bslma&lowbar;exceptionguard&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class OBJECT&gt;
class ExceptionGuard;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/ExceptionGuard/2constructor-00.adoc[`ExceptionGuard`]         [.small]#[constructor]#
| Create the exception guard for the specified `object` at the specified `line` number&period; Optionally, specify `basicAllocator` used to supply memory&period;
| xref:BloombergLP/bslma/ExceptionGuard/2destructor.adoc[`&#126;ExceptionGuard`] [.small]#[destructor]#
| Destroy the exception guard&period; If the guard was not released, verify that the state of the object supplied at construction has not change&period;
| xref:BloombergLP/bslma/ExceptionGuard/release.adoc[`release`] 
| Release the guard from verifying the state of the object&period;
| xref:BloombergLP/bslma/ExceptionGuard/resetValue.adoc[`resetValue`] 
| Reset the expected state of the guarded object, if an exception should propagate past this guard, to the specified `value`, which is set from the specified `line`&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
