47 #ifndef BLOCXX_SCOPE_GUARD_HPP_INCLUDE_GUARD_
48 #define BLOCXX_SCOPE_GUARD_HPP_INCLUDE_GUARD_
50 #include "blocxx/BLOCXX_config.h"
56 class ScopeGuardImplBase
108 template <
typename F>
109 class ScopeGuardImpl0 :
public ScopeGuardImplBase
114 return ScopeGuardImpl0<F>(fun);
134 template <
typename F>
140 template <
typename F,
typename P1>
167 template <
typename F,
typename P1>
168 inline ScopeGuardImpl1<F, P1>
makeGuard(
F fun, P1 p1)
173 template <
typename F,
typename P1,
typename P2>
201 template <
typename F,
typename P1,
typename P2>
202 inline ScopeGuardImpl2<F, P1, P2>
makeGuard(
F fun, P1 p1, P2 p2)
207 template <
typename F,
typename P1,
typename P2,
typename P3>
236 template <
typename F,
typename P1,
typename P2,
typename P3>
237 inline ScopeGuardImpl3<F, P1, P2, P3>
makeGuard(
F fun, P1 p1, P2 p2, P3 p3)
244 template <
class Obj,
typename MemFun>
271 template <
class Obj,
typename MemFun>
272 inline ObjScopeGuardImpl0<Obj, MemFun>
makeObjGuard(Obj& obj, MemFun memFun)
277 template <
typename Ret,
class Obj1,
class Obj2>
283 template <
typename Ret,
class Obj1,
class Obj2>
289 template <
class Obj,
typename MemFun,
typename P1>
317 template <
class Obj,
typename MemFun,
typename P1>
318 inline ObjScopeGuardImpl1<Obj, MemFun, P1>
makeObjGuard(Obj& obj, MemFun memFun, P1 p1)
323 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b>
329 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b>
335 template <
class Obj,
typename MemFun,
typename P1,
typename P2>
364 template <
class Obj,
typename MemFun,
typename P1,
typename P2>
365 inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2>
makeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
370 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b,
typename P2a,
typename P2b>
376 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b,
typename P2a,
typename P2b>
384 #define BLOCXX_CONCATENATE_DIRECT(s1, s2) s1##s2
385 #define BLOCXX_CONCATENATE(s1, s2) BLOCXX_CONCATENATE_DIRECT(s1, s2)
386 #define BLOCXX_ANONYMOUS_VARIABLE(str) BLOCXX_CONCATENATE(str, __LINE__)
388 #define BLOCXX_ON_BLOCK_EXIT blocxx::ScopeGuard BLOCXX_ANONYMOUS_VARIABLE(scopeGuard) = blocxx::makeGuard
389 #define BLOCXX_ON_BLOCK_EXIT_OBJ blocxx::ScopeGuard BLOCXX_ANONYMOUS_VARIABLE(scopeGuard) = blocxx::makeObjGuard