From 795964f63d17ec78d7b11bda8ce745d689884a3a Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 17 Mar 2005 12:09:35 +0000 Subject: [PATCH] bind_function_test added. [SVN r27721] --- include/boost/function/function_base.hpp | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index ceec95d..30f6916 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -422,7 +422,12 @@ public: } template + +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + const Functor* target( Functor * = 0 ) const +#else const Functor* target() const +#endif { if (!manager) return 0; @@ -432,14 +437,23 @@ public: if (!result.obj_ptr) return 0; else { typedef typename detail::function::get_function_tag::type tag; + +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + return get_functor_pointer(tag(), 0, (Functor*)0); +#else return get_functor_pointer(tag(), 0); +#endif } } template bool contains(const F& f) const { +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + if (const F* fp = this->target( (F*)0 )) { +#else if (const F* fp = this->template target()) { +#endif return function_equal(*fp, f); } else { return false; @@ -477,20 +491,36 @@ public: // should be protected, but GCC 2.95.3 will fail to allow access private: template +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + Functor* get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0) +#else Functor* get_functor_pointer(detail::function::function_ptr_tag, int) +#endif { return reinterpret_cast(&functor.func_ptr); } template +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + Functor* get_functor_pointer(Tag, long, Functor * = 0) +#else Functor* get_functor_pointer(Tag, long) +#endif { return static_cast(functor.obj_ptr); } template const Functor* +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0) const +#else get_functor_pointer(detail::function::function_ptr_tag, int) const +#endif { return reinterpret_cast(&functor.func_ptr); } template +#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) + const Functor* get_functor_pointer(Tag, long, Functor * = 0) const +#else const Functor* get_functor_pointer(Tag, long) const +#endif { return static_cast(functor.const_obj_ptr); } };