OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScopeGuard Class Reference

#include <scope.h>

Public Member Functions

template<class Callable >
 ScopeGuard (Callable &&at_exit)
 
 ScopeGuard (const ScopeGuard &)=delete
 
void operator= (const ScopeGuard &)=delete
 
 ScopeGuard (ScopeGuard &&other)
 
 ~ScopeGuard ()
 

Private Attributes

std::function< void()> at_exit_
 

Detailed Description

Definition at line 22 of file scope.h.

Constructor & Destructor Documentation

template<class Callable >
ScopeGuard::ScopeGuard ( Callable &&  at_exit)
inline

Definition at line 25 of file scope.h.

25 : at_exit_(std::forward<Callable>(at_exit)) {}
std::function< void()> at_exit_
Definition: scope.h:43
ScopeGuard::ScopeGuard ( const ScopeGuard )
delete
ScopeGuard::ScopeGuard ( ScopeGuard &&  other)
inline

Definition at line 31 of file scope.h.

31  : at_exit_(std::move(other.at_exit_)) {
32  other.at_exit_ = nullptr;
33  }
std::function< void()> at_exit_
Definition: scope.h:43
ScopeGuard::~ScopeGuard ( )
inline

Definition at line 35 of file scope.h.

References at_exit_.

35  {
36  if (at_exit_) {
37  // note that at_exit_ must not throw
38  at_exit_();
39  }
40  }
std::function< void()> at_exit_
Definition: scope.h:43

Member Function Documentation

void ScopeGuard::operator= ( const ScopeGuard )
delete

Member Data Documentation

std::function<void()> ScopeGuard::at_exit_
private

Definition at line 43 of file scope.h.

Referenced by ~ScopeGuard().


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