libpsynth 0.2.1
Classes | Namespaces | Defines | Typedefs | Functions
/home/raskolnikov/dev/psynth/trunk/src/psynth/base/scope_guard.hpp File Reference

Time-stamp: <2011-03-17 00:19:22 raskolnikov> More...

#include <boost/utility.hpp>
#include <psynth/base/util.hpp>
Include dependency graph for scope_guard.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  psynth::base::scope_guard_impl_base
class  psynth::base::scope_guard_impl< Fun >

Namespaces

namespace  psynth
namespace  psynth::base

Defines

#define PSYNTH_CONCATENATE_DIRECT(s1, s2)   s1##s2
#define PSYNTH_CONCATENATE(s1, s2)   PSYNTH_CONCATENATE_DIRECT(s1, s2)
#define PSYNTH_ANONYMOUS_VARIABLE(str)   PSYNTH_CONCATENATE(str, __LINE__)
#define PSYNTH_ON_BLOCK_EXIT(f)   ::psynth::base::scope_guard PSYNTH_ANONYMOUS_VARIABLE(scope_guard) = ::psynth::base::make_guard(f); ::psynth::base::ignore_unused_variable_warning (PSYNTH_ANONYMOUS_VARIABLE(scope_guard))

Typedefs

typedef const
scope_guard_impl_base & 
psynth::base::scope_guard

Functions

template<typename Fun >
scope_guard_impl< Fun > psynth::base::make_guard (const Fun &fun)

Detailed Description

Time-stamp: <2011-03-17 00:19:22 raskolnikov>

Author:
Juan Pedro BolĂ­var Puente <raskolnikov@es.gnu.org>
Date:
Fri Mar 4 18:49:32 2011

Scope guard for calling a function on scope exit. Specially useful when writting C wrappers.

Based on the well known Loki::ScopeGuard library developed by Andrei Alexandrescu and throughly described here but adapted for easier integration with C++0x lambdas.

http://drdobbs.com/184403758


Define Documentation

#define PSYNTH_ANONYMOUS_VARIABLE (   str)    PSYNTH_CONCATENATE(str, __LINE__)
#define PSYNTH_CONCATENATE (   s1,
  s2 
)    PSYNTH_CONCATENATE_DIRECT(s1, s2)
#define PSYNTH_CONCATENATE_DIRECT (   s1,
  s2 
)    s1##s2
#define PSYNTH_ON_BLOCK_EXIT (   f)    ::psynth::base::scope_guard PSYNTH_ANONYMOUS_VARIABLE(scope_guard) = ::psynth::base::make_guard(f); ::psynth::base::ignore_unused_variable_warning (PSYNTH_ANONYMOUS_VARIABLE(scope_guard))