Scope
 All Classes Functions Pages
scope::scope_exit< Fn > Class Template Reference

An exit handler for handling both sucess an error cases. More...

#include <scope.hpp>

+ Inheritance diagram for scope::scope_exit< Fn >:
+ Collaboration diagram for scope::scope_exit< Fn >:

Detailed Description

template<typename Fn>
class scope::scope_exit< Fn >

An exit handler for handling both sucess an error cases.

This will always execute the stored function unless 'release' has been called.

When working in C++17 and above, you can use the automatic class type-deduction in order to create an instance of this:

auto guard = scope::scope_exit{[&]{
...
}};

When working in any C++11 or C++14, convenience functions are also added to perform this deduction for you:

auto guard = scope::make_scope_exit([&]{
...
});
Template Parameters
Fnthe function type for the scope to execute

Definition at line 478 of file scope.hpp.


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