Dev Essential  1.6.3
Loading...
Searching...
No Matches
a_util::ScopeGuard< F > Class Template Reference

#include <scopeguard.h>

Public Member Functions

 ScopeGuard (const ScopeGuard &)=delete
 
ScopeGuardoperator= (const ScopeGuard &)=delete
 
ScopeGuardoperator= (ScopeGuard &&other)=delete
 
 ScopeGuard (ScopeGuard &&other)
 
 ScopeGuard (F &&f)
 
 ~ScopeGuard ()
 
void dismiss () noexcept
 
void rehire () noexcept
 

Detailed Description

template<class F>
class a_util::ScopeGuard< F >

Scope guard executing a callable object of type F on scope exit.

The callable execution can be disabled/re-enabled by using dismiss() or rehire() respectively (default: enabled).

To actually create scope guards objects, the following convenience functions are provided:

Template Parameters
FType of the callable object (pointer to function, lambda, etc.)

Constructor & Destructor Documentation

◆ ScopeGuard()

template<class F>
a_util::ScopeGuard< F >::ScopeGuard ( F && f)
inlineexplicit

Ctor

Parameters
[in]fThe callable object to execute on scope exit

◆ ~ScopeGuard()

template<class F>
a_util::ScopeGuard< F >::~ScopeGuard ( )
inline

Destroy the scope guard object and execute the callable if execution is enabled

Member Function Documentation

◆ dismiss()

template<class F>
void a_util::ScopeGuard< F >::dismiss ( )
inlinenoexcept

Dismiss the execution of the callable on scope exit

◆ rehire()

template<class F>
void a_util::ScopeGuard< F >::rehire ( )
inlinenoexcept

Rehire the execution of the callable on scope exit


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