1.10
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...

#include <meta.h>

Public Member Functions

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

Protected Attributes

bool m_active
 Used to manage move.
 
m_f
 Callback function.
 

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]

template<class T >
ScopeExit ( T &&  f)
inlineexplicitnoexcept
Parameters
fCallable to call on destruction.

◆ ScopeExit() [2/5]

template<class T >
ScopeExit ( const T &  f)
inlineexplicitnoexcept
Parameters
fCallable to call on destruction.

◆ ScopeExit() [3/5]

template<class T >
ScopeExit ( ScopeExit< T > &&  other)
inlinenoexcept

Move constructor.

◆ ScopeExit() [4/5]

template<class T >
ScopeExit ( )
delete

◆ ScopeExit() [5/5]

template<class T >
ScopeExit ( const ScopeExit< T > &  )
delete

◆ ~ScopeExit()

template<class T >
~ScopeExit ( )
inline

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Member Data Documentation

◆ m_active

template<class T >
bool m_active
protected

Used to manage move.

◆ m_f

template<class T >
T m_f
protected

Callback function.