Sunshine master
Self-hosted game stream host for Moonlight.
util::FailGuard< T > Class Template Reference

Scope guard that runs a cleanup action unless it is disabled. More...

#include <src/utility.h>

Public Member Functions

void disable ()
 Disable the fail guard so destruction will not run the cleanup action.
 
 FailGuard (const FailGuard &)=delete
 
 FailGuard (FailGuard &&other) noexcept
 Construct a fail guard that owns the cleanup callback.
 
 FailGuard (T &&f) noexcept
 Construct a fail guard that owns the cleanup callback.
 
FailGuardoperator= (const FailGuard &)=delete
 
FailGuardoperator= (FailGuard &&other)=delete
 

Public Attributes

bool failure {true}
 Whether the fail guard should run its cleanup action.
 

Detailed Description

template<class T>
class util::FailGuard< T >

Scope guard that runs a cleanup action unless it is disabled.

Constructor & Destructor Documentation

◆ FailGuard() [1/2]

template<class T >
util::FailGuard< T >::FailGuard ( T && f)
inlinenoexcept

Construct a fail guard that owns the cleanup callback.

Parameters
fCallable executed by the helper.

◆ FailGuard() [2/2]

template<class T >
util::FailGuard< T >::FailGuard ( FailGuard< T > && other)
inlinenoexcept

Construct a fail guard that owns the cleanup callback.

Parameters
otherSource object whose state is copied or moved into this object.

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