From b7608dff24503a6174e03c786e37bd2d54e531b5 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 30 Jan 2004 17:15:03 +0000 Subject: [PATCH] type_info::operator== fixes (Peter Dimov) [SVN r22083] --- include/boost/function/function_base.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 6da90a2..2729c6f 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -38,7 +38,7 @@ # define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \ (std::strcmp((X).name(),(Y).name()) == 0) # else -# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) (X==Y) +# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y)) #endif #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) @@ -200,8 +200,9 @@ namespace boost { case check_functor_type_tag: { std::type_info* t = static_cast(f.obj_ptr); - bool equal = BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(F), *t); - return equal? f : make_any_pointer(reinterpret_cast(0)); + return BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(F), *t)? + f + : make_any_pointer(reinterpret_cast(0)); } } @@ -295,9 +296,8 @@ namespace boost { if (op == check_functor_type_tag) { std::type_info* type = static_cast(functor_ptr.obj_ptr); - bool equal = - BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type); - return (equal? functor_ptr + return (BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type)? + functor_ptr : make_any_pointer(reinterpret_cast(0))); } else { @@ -494,4 +494,6 @@ namespace detail { } // end namespace detail } // end namespace boost +#undef BOOST_FUNCTION_COMPARE_TYPE_ID + #endif // BOOST_FUNCTION_BASE_HEADER