Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
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
 Explicitly construct a fail guard that owns the cleanup callback.
FailGuard & operator= (const FailGuard &)=delete
FailGuard & operator= (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)
inlineexplicitnoexcept

Explicitly 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: