AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface

◆ ScopeGuard() [1/2]

template<typename T >
drama::ScopeGuard< T >::ScopeGuard ( T &  item,
const executionVal 
)
inline

Construct a ScopeGuard for the specified item.

It is set to the "executionVal" value at this point. When the destructor is invoked, it is reset to its initial value.

Note
The value in the item is not protected during the existence of this object. It is set to executionVal when this object is constructed and set back to its initial value when the object is destroyed, but nothing prevents it being changed while the object exists, and in that case, the changed value is overwritten when this object is destroyed.
Parameters
itemThe item to be guarded.
executionValThe value that should be placed in the item when this constructed is executed.

References drama::CreateRunDramaTask().