From 4d635501ab9eb2fc78119ea5c47dfe6b03f7d970 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 14 May 2002 14:18:36 +0000 Subject: [PATCH] function_base.hpp: function_template.hpp: - Revert to older implementation of has_empty_function (Metrowerks doesn't handle is_base_and_derived correctly) [SVN r13854] --- include/boost/function/function_base.hpp | 16 +++++----------- include/boost/function/function_template.hpp | 12 ++---------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index f817e6a..d827538 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -341,20 +341,14 @@ namespace boost { namespace detail { namespace function { - // The result is not a Boost.Function object, so we assume that this - // target is not empty - template - inline bool has_empty_target(const FunctionObj&, truth) + inline bool has_empty_target(const function_base* f) { - return false; + return f->empty(); } - // The result is a Boost.Function object, so query whether it is empty - // or not - template - inline bool has_empty_target(const FunctionObj& f, truth) - { - return f.empty(); + inline bool has_empty_target(...) + { + return false; } } // end namespace function } // end namespace detail diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index ab0d18e..d7057c7 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -425,11 +425,7 @@ namespace boost { template void assign_to(FunctionObj f, detail::function::function_obj_tag) { - typedef detail::function::truth< - boost::is_base_and_derived::value> - is_boost_function; - - if (!detail::function::has_empty_target(f, is_boost_function())) { + if (!detail::function::has_empty_target(addressof(f))) { typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< FunctionObj, @@ -463,11 +459,7 @@ namespace boost { void assign_to(const reference_wrapper& f, detail::function::function_obj_ref_tag) { - typedef detail::function::truth< - boost::is_base_and_derived::value> - is_boost_function; - - if (!detail::function::has_empty_target(f.get(), is_boost_function())) { + if (!detail::function::has_empty_target(f.get_pointer())) { typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< FunctionObj,