KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
kjb::Scope_guard Struct Reference

#include <l_scope_guard.h>

Public Member Functions

 Scope_guard (const boost::function0< void > &callback)
 

Public Attributes

boost::shared_ptr< void > on_exit_
 

Detailed Description

A simple object that calls a callback when it leaves scope. This is very useful to ensure exception-safety when a resource is obtained at the beginning of a scope and it must be released at the end.

If this object is copied, the callback is called when all copies are deleted.

Author
Kyle Simek

Constructor & Destructor Documentation

kjb::Scope_guard::Scope_guard ( const boost::function0< void > &  callback)
inline

Member Data Documentation

boost::shared_ptr<void> kjb::Scope_guard::on_exit_

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