DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::foundation::ScopeExecutor Class Reference

Provides a RAII way to execute a bit of code upon the destruction of the object. More...

#include <ScopeExecutor.h>

Collaboration diagram for drn::foundation::ScopeExecutor:

Public Member Functions

 ScopeExecutor (std::function< void()> execute)
 Full initialisation constructor.
 
 ~ScopeExecutor ()
 Executes the supplied function.
 

Detailed Description

Provides a RAII way to execute a bit of code upon the destruction of the object.

Constructor & Destructor Documentation

◆ ScopeExecutor()

drn::foundation::ScopeExecutor::ScopeExecutor ( std::function< void()> execute)

Full initialisation constructor.

Parameters
executeThe function that should be executed upon object destruction. The executable function must not throw.

◆ ~ScopeExecutor()

drn::foundation::ScopeExecutor::~ScopeExecutor ( )

Executes the supplied function.