From 68128bfffa65118692f66572438de60ef5f326c1 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sun, 7 Jun 2009 15:44:50 +0000 Subject: [PATCH] Make Boost.Function compile with disabled exceptions. Closes #2900. Patch from Gabi Davar. [SVN r53722] --- include/boost/function/function_template.hpp | 33 ++++++++++---------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 5f5ea0b..e02b9bd 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -11,6 +11,7 @@ // Note: this header is a header template and must NOT have multiple-inclusion // protection. #include +#include #if defined(BOOST_MSVC) # pragma warning( push ) @@ -786,24 +787,26 @@ namespace boost { operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { this->clear(); - try { + BOOST_TRY { this->assign_to(f); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END return *this; } template void assign(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a) { this->clear(); - try { + BOOST_TRY{ this->assign_to_a(f,a); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END } #ifndef BOOST_NO_SFINAE @@ -828,12 +831,13 @@ namespace boost { return *this; this->clear(); - try { + BOOST_TRY { this->assign_to_own(f); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END return *this; } @@ -965,9 +969,7 @@ namespace boost { if (&f == this) return; -#if !defined(BOOST_NO_EXCEPTIONS) - try { -#endif + BOOST_TRY { if (!f.empty()) { this->vtable = f.vtable; if (this->has_trivial_copy_and_destroy()) @@ -979,12 +981,11 @@ namespace boost { } else { clear(); } -#if !defined(BOOST_NO_EXCEPTIONS) - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } -#endif + BOOST_CATCH_END } };