OSVR-Core
Classes | Namespaces | Functions
Finally.h File Reference

Header declaring a C++11 finally or "scope-guard" construct. More...

#include <utility>

Go to the source code of this file.

Classes

class  osvr::util::FinalTask< F >
 Allows you to run a callable something at the end of a scope. More...
 

Namespaces

 osvr
 The main namespace for all C++ elements of the framework, internal and external.
 
 osvr::util
 The Util library: Functionality not necessarily coupled to any particular core library, serving more as a common base layer behind all systems.
 

Functions

template<typename F >
FinalTask< F > osvr::util::finally (F &&f)
 Creation free function for final tasks to run on scope exit. More...
 
template<typename F >
FinalTask< F > osvr::util::finally (F const &f)
 

Detailed Description

Header declaring a C++11 finally or "scope-guard" construct.

Inspirations are many - Alexandrescu's original and C++11 ScopeGuard, and the Guideline Support Library's (GSL) final_act/finally https://github.com/Microsoft/GSL/blob/0cf947db7760bf5756e4cb0d47c72a257ed527c5/include/gsl_util.h come to mind, but this has been written and re-written numerous times since its introduction into the C++ global consciousness, and this implementation was written independently after I couldn't find a previous independent implementation I had written a few weeks earlier in an implementation file. – Ryan Pavlik

Date
2016
Author
Sensics, Inc. http://sensics.com/osvr