libdl  0.0.1
Simple yet powerful deep learning
Loading...
Searching...
No Matches
dl::utils::ScopeGuard Class Referencefinal

#include <scopeguard.hpp>

Public Member Functions

 ScopeGuard (auto &&onScopeExit)
 
 ScopeGuard (ScopeGuard &&other)
 

Detailed Description

{ScopeGuard _([] { std::cout << "Scope Exited" << std::endl; });
std::cout << "Inside Scope" << std::endl;
}
T endl(T... args)

Definition at line 16 of file scopeguard.hpp.

Constructor & Destructor Documentation

◆ ScopeGuard() [1/2]

dl::utils::ScopeGuard::ScopeGuard ( auto &&  onScopeExit)
inlineexplicit

Definition at line 24 of file scopeguard.hpp.

24 : onScopeExit(std::forward<decltype(onScopeExit)>(onScopeExit)) {
25 } catch (...) {
26 onScopeExit();
27 throw;
28 }
T forward(T... args)

◆ ScopeGuard() [2/2]

dl::utils::ScopeGuard::ScopeGuard ( ScopeGuard &&  other)
inlineexplicit

Definition at line 30 of file scopeguard.hpp.

30 : onScopeExit(std::move(other.onScopeExit)) {
31 assert(other.onScopeExit == nullptr);
32 }
T move(T... args)

◆ ~ScopeGuard()

dl::utils::ScopeGuard::~ScopeGuard ( )
inline

Definition at line 34 of file scopeguard.hpp.

34 {
35 if (onScopeExit != nullptr)
36 onScopeExit();
37 }

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