Camargue
Public Member Functions | Private Attributes | List of all members
CMR::util::ScopeGuard< act_type > Class Template Reference

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.
 
ScopeGuardoperator= (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.
 

Detailed Description

template<typename act_type>
class CMR::util::ScopeGuard< act_type >

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.


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