Support comparisons against 0 on MSVC

[SVN r16618]
This commit is contained in:
Douglas Gregor
2002-12-15 16:05:01 +00:00
parent b62c8066a3
commit a75e20c3ed

View File

@ -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)