mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
mrs_lib::ScopeCleanup< T > Class Template Reference

Utility class for running cleanup at the end of a scope. More...

#include <scope_cleanup.hpp>

Public Member Functions

 ScopeCleanup (T f)
 Create a scope cleanup that runs the specified callable when destroyed.
 
 ScopeCleanup (const ScopeCleanup &)=delete
 
 ScopeCleanup (ScopeCleanup &&)=delete
 
ScopeCleanupoperator= (const ScopeCleanup &)=delete
 
ScopeCleanupoperator= (ScopeCleanup &&)=delete
 
void cancel ()
 Disable running of the callback, when the cleanup object is destroyed.
 

Detailed Description

template<typename T>
class mrs_lib::ScopeCleanup< T >

Utility class for running cleanup at the end of a scope.

Constructor & Destructor Documentation

◆ ScopeCleanup()

template<typename T >
mrs_lib::ScopeCleanup< T >::ScopeCleanup ( f)
inlineexplicit

Create a scope cleanup that runs the specified callable when destroyed.

Note
The object must be stored in a variable, otherwise, it will be destroyed immediately.

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