LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes
LogCabin::Core::Util::Finally Class Reference

Calls a function when this object goes out of scope. More...

#include <Util.h>

List of all members.

Public Member Functions

 Finally (std::function< void()> onDestroy)
 ~Finally ()

Public Attributes

std::function< void()> onDestroy

Detailed Description

Calls a function when this object goes out of scope.

This is useful for deferring execution of something until the end of the scope without creating a full-blown RAII class to wrap it. It's named after the try { .. } finally { ... } control structure found in many languages. See also http://www.stroustrup.com/bs_faq2.html#finally

Definition at line 61 of file Util.h.


Constructor & Destructor Documentation

LogCabin::Core::Util::Finally::Finally ( std::function< void()>  onDestroy) [inline, explicit]

Definition at line 63 of file Util.h.

Definition at line 66 of file Util.h.


Member Data Documentation

Definition at line 69 of file Util.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines