type_info::operator== fixes (Peter Dimov)

[SVN r22083]
This commit is contained in:
Douglas Gregor
2004-01-30 17:15:03 +00:00
parent 5f0426a80d
commit b7608dff24

View File

@ -38,7 +38,7 @@
# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \ # define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \
(std::strcmp((X).name(),(Y).name()) == 0) (std::strcmp((X).name(),(Y).name()) == 0)
# else # else
# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) (X==Y) # define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y))
#endif #endif
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) #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: case check_functor_type_tag:
{ {
std::type_info* t = static_cast<std::type_info*>(f.obj_ptr); std::type_info* t = static_cast<std::type_info*>(f.obj_ptr);
bool equal = BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(F), *t); return BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(F), *t)?
return equal? f : make_any_pointer(reinterpret_cast<void*>(0)); f
: make_any_pointer(reinterpret_cast<void*>(0));
} }
} }
@ -295,9 +296,8 @@ namespace boost {
if (op == check_functor_type_tag) { if (op == check_functor_type_tag) {
std::type_info* type = std::type_info* type =
static_cast<std::type_info*>(functor_ptr.obj_ptr); static_cast<std::type_info*>(functor_ptr.obj_ptr);
bool equal = return (BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type)?
BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type); functor_ptr
return (equal? functor_ptr
: make_any_pointer(reinterpret_cast<void*>(0))); : make_any_pointer(reinterpret_cast<void*>(0)));
} }
else { else {
@ -494,4 +494,6 @@ namespace detail {
} // end namespace detail } // end namespace detail
} // end namespace boost } // end namespace boost
#undef BOOST_FUNCTION_COMPARE_TYPE_ID
#endif // BOOST_FUNCTION_BASE_HEADER #endif // BOOST_FUNCTION_BASE_HEADER