halcheck 1.0
Loading...
Searching...
No Matches
halcheck::lib::finally_t< F > Class Template Reference

Calls a function upon destruction. More...

#include <scope.hpp>

Public Member Functions

constexpr finally_t ()=default
 A default-constructed finally_t does nothing upon scope exit.
 
constexpr finally_t (F func) noexcept(std::is_nothrow_move_constructible< F >())
 Construct an object that calls the given function upon destruction.
 
 finally_t (finally_t &&other) noexcept(std::is_nothrow_move_constructible< F >())
 Delays the invocation of a finally_t's underlying function by transfering the responsibility of calling the function to a new finally_t.
 
template<typename G >
 finally_t (finally_t< G > &&other) noexcept(std::is_constructible< F, G >())
 Delays the invocation of a finally_t's underlying function by transfering the responsibility of calling the function to a new finally_t.
 
template<typename G >
 finally_t (finally_t< G > &&other) noexcept(std::is_constructible< F, G >())
 Delays the invocation of a finally_t's underlying function by transfering the responsibility of calling the function to a new finally_t.
 
 finally_t (const finally_t &)=delete
 
finally_toperator= (const finally_t &)=delete
 
finally_toperator= (finally_t &&)=delete
 
void * operator new (std::size_t)=delete
 
void * operator new[] (std::size_t)=delete
 
 ~finally_t () noexcept
 Invokes the underlying function.
 

Friends

template<typename G >
finally_t< combine< G > > operator+ (finally_t &&lhs, finally_t< G > &&rhs)
 Combines two finally_t values into one, such that both underlying functions are called upon destruction of the return value.
 

Related Symbols

(Note that these are not member symbols.)

template<typename F >
lib::finally_t< F > finally (F func)
 

Detailed Description

template<typename F = lib::move_only_function<void() &&>>
class halcheck::lib::finally_t< F >

Calls a function upon destruction.

Template Parameters
FThe type of function to call upon destruction.

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