Gorgon Game Engine
ScopeGuard Class Reference

This class guards a scope and as soon as the object runs out of scope calls the given function. More...

Public Member Functions

 ScopeGuard ()=default
 Construct an empty scope guard. More...
 
 ScopeGuard (const ScopeGuard &)=delete
 No copying. More...
 
template<class F_ >
 ScopeGuard (F_ &&fn)
 Construct a scope guard with the given function. More...
 
 ScopeGuard (ScopeGuard &&other)
 Move constructor. More...
 
 ~ScopeGuard ()
 Destructor. More...
 
template<class F_ >
void Arm (F_ &&value)
 Arms the scope guard with the given function. More...
 
void Disarm ()
 Disarm this scope guard, after this function it will not fire. More...
 
ScopeGuardoperator= (const ScopeGuard &)=delete
 No copy assignment. More...
 
ScopeGuardoperator= (ScopeGuard &&other)
 Move assignment. More...
 

Detailed Description

This class guards a scope and as soon as the object runs out of scope calls the given function.

Constructor & Destructor Documentation

◆ ScopeGuard() [1/4]

ScopeGuard ( F_ &&  fn)

Construct a scope guard with the given function.

◆ ScopeGuard() [2/4]

ScopeGuard ( )
default

Construct an empty scope guard.

◆ ScopeGuard() [3/4]

ScopeGuard ( ScopeGuard &&  other)

Move constructor.

◆ ScopeGuard() [4/4]

ScopeGuard ( const ScopeGuard )
delete

No copying.

◆ ~ScopeGuard()

~ScopeGuard ( )

Destructor.

Member Function Documentation

◆ Arm()

void Arm ( F_ &&  value)

Arms the scope guard with the given function.

◆ Disarm()

void Disarm ( )

Disarm this scope guard, after this function it will not fire.

◆ operator=() [1/2]

ScopeGuard& operator= ( const ScopeGuard )
delete

No copy assignment.

◆ operator=() [2/2]

ScopeGuard& operator= ( ScopeGuard &&  other)

Move assignment.


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