From a75e20c3edeb2db989a5bceb169244b8c425b1fc Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sun, 15 Dec 2002 16:05:01 +0000 Subject: [PATCH] Support comparisons against 0 on MSVC [SVN r16618] --- include/boost/function/function_base.hpp | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 53ba8e6..d335118 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -329,6 +329,8 @@ namespace boost { }; #endif + // A type that is only used for comparisons against zero + struct useless_clear_type {}; } // end namespace function } // end namespace detail @@ -375,6 +377,32 @@ public: void operator==(const function_base&, const function_base&); void operator!=(const function_base&, const function_base&); +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +inline bool operator==(const function_base& f, + detail::function::useless_clear_type*) +{ + return f.empty(); +} + +inline bool operator!=(const function_base& f, + detail::function::useless_clear_type*) +{ + return !f.empty(); +} + +inline bool operator==(detail::function::useless_clear_type*, + const function_base& f) +{ + return f.empty(); +} + +inline bool operator!=(detail::function::useless_clear_type*, + const function_base& f) +{ + return !f.empty(); +} +#endif + namespace detail { namespace function { inline bool has_empty_target(const function_base* f)