1.8
Public Member Functions | Protected Attributes | List of all members
ScopeExit< T > Struct Template Reference

Utility to run a callback when this object goes out of scope. More...

Public Member Functions

 ScopeExit ()=delete
 
 ScopeExit (const ScopeExit &)=delete
 
 ScopeExit (const T &f) noexcept
 
 ScopeExit (ScopeExit &&other) noexcept
 Move constructor. More...
 
 ScopeExit (T &&f) noexcept
 
 ~ScopeExit ()
 
ScopeExitoperator= (const ScopeExit &)=delete
 
ScopeExitoperator= (ScopeExit &&)=delete
 

Protected Attributes

bool m_active
 Used to manage move. More...
 
m_f
 Callback function. More...
 

Detailed Description

template<class T>
struct egt::v1::detail::ScopeExit< T >

Utility to run a callback when this object goes out of scope.

This can be used to run a callable when an instance of a ScopeExit goes out of scope or is deleted.

Constructor & Destructor Documentation

◆ ScopeExit() [1/5]

ScopeExit ( T &&  f)
inlineexplicitnoexcept
Parameters
fCallable to call on destruction.

◆ ScopeExit() [2/5]

ScopeExit ( const T &  f)
inlineexplicitnoexcept
Parameters
fCallable to call on destruction.

◆ ScopeExit() [3/5]

ScopeExit ( ScopeExit< T > &&  other)
inlinenoexcept

Move constructor.

◆ ScopeExit() [4/5]

ScopeExit ( )
delete

◆ ScopeExit() [5/5]

ScopeExit ( const ScopeExit< T > &  )
delete

◆ ~ScopeExit()

~ScopeExit ( )
inline

Member Function Documentation

◆ operator=() [1/2]

ScopeExit& operator= ( const ScopeExit< T > &  )
delete

◆ operator=() [2/2]

ScopeExit& operator= ( ScopeExit< T > &&  )
delete

Member Data Documentation

◆ m_active

bool m_active
protected

Used to manage move.

◆ m_f

T m_f
protected

Callback function.