From 3e9d0232d2374ede6bb3035bef8210ec18d6df19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20M=20L=C3=B3pez=20Mu=C3=B1oz?= Date: Fri, 4 Mar 2011 08:06:42 +0000 Subject: [PATCH] closed #5260 [SVN r69540] --- include/boost/multi_index/detail/scope_guard.hpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/boost/multi_index/detail/scope_guard.hpp b/include/boost/multi_index/detail/scope_guard.hpp index 12624c5..caaf333 100644 --- a/include/boost/multi_index/detail/scope_guard.hpp +++ b/include/boost/multi_index/detail/scope_guard.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2008 Joaquin M Lopez Munoz. +/* Copyright 2003-2011 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -13,6 +13,8 @@ #pragma once #endif +#include + namespace boost{ namespace multi_index{ @@ -24,12 +26,10 @@ namespace detail{ * ScopeGuard.h as defined in: * Alexandrescu, A., Marginean, P.:"Generic: Change the Way You * Write Exception-Safe Code - Forever", C/C++ Users Jornal, Dec 2000, - * http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/ + * http://www.drdobbs.com/184403758 * with the following modifications: * - General pretty formatting (pretty to my taste at least.) * - Naming style changed to standard C++ library requirements. - * - safe_execute does not feature a try-catch protection, so we can - * use this even if BOOST_NO_EXCEPTIONS is defined. * - Added scope_guard_impl4 and obj_scope_guard_impl3, (Boost.MultiIndex * needs them). A better design would provide guards for many more * arguments through the Boost Preprocessor Library. @@ -65,7 +65,13 @@ protected: } template - static void safe_execute(J& j){if(!j.dismissed_)j.execute();} + static void safe_execute(J& j){ + BOOST_TRY{ + if(!j.dismissed_)j.execute(); + } + BOOST_CATCH(...){} + BOOST_CATCH_END + } mutable bool dismissed_;