General Utility Library for C++14  2.11
Classes | Functions
gul14/finalizer.h

Detailed Description

Executing some clean-up code when leaving a scope.

Classes

class  gul14::FinalAction< F >
 FinalAction allows us to execute something if the FinalAction object leaves the scope. More...
 

Functions

template<typename F >
FinalAction< typename std::decay_t< F > > gul14::finally (F &&f) noexcept
 finally() - convenience function to generate a FinalAction More...
 

Function Documentation

◆ finally()

template<typename F >
FinalAction<typename std::decay_t<F> > gul14::finally ( F &&  f)
noexcept

finally() - convenience function to generate a FinalAction

A FinalAction can be used to add RAII like behavior for non RAII object or to do timing measurements. More information given in the FinalAction documentation.

Template Parameters
FThe type of the closure/function to be called (normally autodeduced).
Parameters
fThe closure or pointer to function to be called on destruction.
Since
GUL version 1.1