System::ScopeGuard< F > Struct Template Reference

The service class that provides services for running a particular function object when an instance of the class goes out of scope. More...

Public Member Functions

 ScopeGuard (F f)
 Constructs an instance that is set up to invoke the specified function object. More...
 
 ~ScopeGuard () noexcept(false)
 Invokes the function object passed to the constructor. More...
 

Detailed Description

template<typename F>
struct System::ScopeGuard< F >

The service class that provides services for running a particular function object when an instance of the class goes out of scope.

Template Parameters
FThe type of the function object invoked by the instances of the ScopedGuard class

Constructor & Destructor Documentation

◆ ScopeGuard()

template<typename F >
System::ScopeGuard< F >::ScopeGuard ( f)
inline

Constructs an instance that is set up to invoke the specified function object.

Parameters
fThe function object to be invoked in the destructor of the object being constructed.

◆ ~ScopeGuard()

template<typename F >
System::ScopeGuard< F >::~ScopeGuard ( )
inlinenoexcept

Invokes the function object passed to the constructor.