Fix semantics for comparison against reference_wrappers

[SVN r21901]
This commit is contained in:
Douglas Gregor
2004-01-24 23:31:40 +00:00
parent c31ad8700e
commit 746676d274
3 changed files with 145 additions and 8 deletions

View File

@ -318,17 +318,19 @@ namespace boost {
// for compilers that don't support SFINAE.
template<typename Function, typename Functor>
bool
compare_equal(const Function& f, const Functor&, mpl::bool_<true>)
compare_equal(const Function& f, const Functor&, int, mpl::bool_<true>)
{ return f.empty(); }
template<typename Function, typename Functor>
bool
compare_not_equal(const Function& f, const Functor&, mpl::bool_<true>)
compare_not_equal(const Function& f, const Functor&, int,
mpl::bool_<true>)
{ return !f.empty(); }
template<typename Function, typename Functor>
bool
compare_equal(const Function& f, const Functor& g, mpl::bool_<false>)
compare_equal(const Function& f, const Functor& g, long,
mpl::bool_<false>)
{
if (const Functor* fp = f.template target<Functor>())
return *fp == g;
@ -337,13 +339,34 @@ namespace boost {
template<typename Function, typename Functor>
bool
compare_not_equal(const Function& f, const Functor& g,
compare_equal(const Function& f, const reference_wrapper<Functor>& g,
int, mpl::bool_<false>)
{
if (const Functor* fp = f.template target<Functor>())
return fp == g.get_pointer();
else return false;
}
template<typename Function, typename Functor>
bool
compare_not_equal(const Function& f, const Functor& g, long,
mpl::bool_<false>)
{
if (const Functor* fp = f.template target<Functor>())
return *fp != g;
else return true;
}
template<typename Function, typename Functor>
bool
compare_not_equal(const Function& f,
const reference_wrapper<Functor>& g, int,
mpl::bool_<false>)
{
if (const Functor* fp = f.template target<Functor>())
return fp != g.get_pointer();
else return true;
}
#endif // BOOST_NO_SFINAE
} // end namespace function
} // end namespace detail