kaycxx-core
C++ core library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
kaycxx::core::scope_exit< F > Class Template Reference

Executes a callback when the current scope exits. More...

#include <kaycxx/core/scope.hpp>

Public Member Functions

 scope_exit (F callback)
 Creates a scope guard that runs the callback during destruction.
 
 scope_exit (const scope_exit &)=delete
 
scope_exitoperator= (const scope_exit &)=delete
 
 scope_exit (scope_exit &&)=delete
 
scope_exitoperator= (scope_exit &&)=delete
 

Detailed Description

template<typename F>
requires std::invocable<F&> && std::is_nothrow_invocable_v<F&>
class kaycxx::core::scope_exit< F >

Executes a callback when the current scope exits.

This is a small replacement for std::scope_exit and should become obsolete once the supported compilers and standard libraries provide the official implementation.

Constructor & Destructor Documentation

◆ scope_exit()

template<typename F >
kaycxx::core::scope_exit< F >::scope_exit ( callback)
inlineexplicit

Creates a scope guard that runs the callback during destruction.

Parameters
callback- The callback to run when the scope guard is destroyed.

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