|
Camargue
|
Code from Andrei Alexandrescu's ScopeGuard11 slides. More...
#include <err_util.hpp>
Public Member Functions | |
| ScopeGuard (act_type action) | |
Construct a ScopeGuard to performs action upon going out of scope. | |
| ~ScopeGuard () | |
| Perform the final_action. | |
| void | dismiss () |
| Indicate that final_action should not happen. | |
| ScopeGuard ()=delete | |
| No default constructor. | |
| ScopeGuard (const ScopeGuard &)=delete | |
| No copy constructor. | |
| ScopeGuard & | operator= (const ScopeGuard &)=delete |
| No copy assign. | |
| ScopeGuard (ScopeGuard &&rhs) | |
Move constructor. Moved from ScopeGuard rhs is dismissed. | |
Private Attributes | |
| act_type | final_action |
| A function to be called on destruction. | |
| bool | active |
| True iff final_action should be performed on destruction. | |
Code from Andrei Alexandrescu's ScopeGuard11 slides.
This class provides a limited implementation of ScopeGuard. I have not bothered with the macro definitions for scope exit, or for operator + on a scope guard; all cleanup tasks must be specified upon construction.
1.8.11