Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69540 - trunk/boost/multi_index/detail
From: joaquin_at_[hidden]
Date: 2011-03-04 03:06:48


Author: joaquin
Date: 2011-03-04 03:06:42 EST (Fri, 04 Mar 2011)
New Revision: 69540
URL: http://svn.boost.org/trac/boost/changeset/69540

Log:
closed #5260
Text files modified:
   trunk/boost/multi_index/detail/scope_guard.hpp | 16 +++++++++++-----
   1 files changed, 11 insertions(+), 5 deletions(-)

Modified: trunk/boost/multi_index/detail/scope_guard.hpp
==============================================================================
--- trunk/boost/multi_index/detail/scope_guard.hpp (original)
+++ trunk/boost/multi_index/detail/scope_guard.hpp 2011-03-04 03:06:42 EST (Fri, 04 Mar 2011)
@@ -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 <boost/detail/no_exceptions_support.hpp>
+
 namespace boost{
 
 namespace multi_index{
@@ -24,12 +26,10 @@
  * ScopeGuard.h as defined in:
  * Alexandrescu, A., Marginean, P.:"Generic<Programming>: 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 @@
   }
 
   template<typename J>
- 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_;
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk