cesium-native  0.41.0
CesiumUtility::ScopeGuard< ExitFunction > Class Template Reference

A utility that will automatically call the lambda function when exiting a scope. More...

#include <CesiumUtility/ScopeGuard.h>

Public Member Functions

template<typename ExitFunctionArg , typename std::enable_if_t< !std::is_same_v< std::remove_reference_t< std::remove_const_t< ExitFunctionArg >>, ScopeGuard< ExitFunction >>, int > = 0>
 ScopeGuard (ExitFunctionArg &&_exitFunc)
 Constructor. More...
 
 ScopeGuard (const ScopeGuard &rhs)=delete
 
 ScopeGuard (ScopeGuard &&rhs) noexcept
 Move constructor. The rhs will move its lambda to the lhs, and the rhs will not call its lambda upon exiting a scope.
 
ScopeGuardoperator= (const ScopeGuard &rhs)=delete
 
ScopeGuardoperator= (ScopeGuard &&rhs) noexcept
 Move assignment operator. The rhs will move its lambda to the lhs, and the rhs will not call its lambda upon exiting a scope.
 
 ~ScopeGuard () noexcept
 Destructor. The guard will execute the lambda function when exiting a scope if it's not released.
 
void release () noexcept
 Upon calling ScopeGuard::release(), the guard will not execute the lambda function when exiting a scope.
 

Detailed Description

template<typename ExitFunction>
class CesiumUtility::ScopeGuard< ExitFunction >

A utility that will automatically call the lambda function when exiting a scope.

Template Parameters
ExitFunctionThe function type to be called when the guard is out of scope.

Definition at line 14 of file ScopeGuard.h.

Constructor & Destructor Documentation

◆ ScopeGuard()

template<typename ExitFunction >
template<typename ExitFunctionArg , typename std::enable_if_t< !std::is_same_v< std::remove_reference_t< std::remove_const_t< ExitFunctionArg >>, ScopeGuard< ExitFunction >>, int > = 0>
CesiumUtility::ScopeGuard< ExitFunction >::ScopeGuard ( ExitFunctionArg &&  _exitFunc)
inlineexplicit

Constructor.

Parameters
ExitFunctionArgThe function type to be called when the guard is out of scope

Definition at line 29 of file ScopeGuard.h.


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