LogCabin
|
Calls a function when this object goes out of scope. More...
#include <Util.h>
Public Member Functions | |
Finally (std::function< void()> onDestroy) | |
~Finally () | |
Public Attributes | |
std::function< void()> | onDestroy |
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
LogCabin::Core::Util::Finally::Finally | ( | std::function< void()> | onDestroy | ) | [inline, explicit] |
LogCabin::Core::Util::Finally::~Finally | ( | ) | [inline] |
std::function<void()> LogCabin::Core::Util::Finally::onDestroy |