forked from boostorg/bind
bind_t now implements function_equal instead of operator==
[SVN r27630]
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
|
||||||
// Copyright (c) 2001 David Abrahams
|
// Copyright (c) 2001 David Abrahams
|
||||||
|
// Copyright (c) 2005 Peter Dimov
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
@@ -919,18 +920,55 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// bind_t::operator==
|
// function_equal
|
||||||
|
|
||||||
template<class R, class F, class L> bool operator==(bind_t<R, F, L> const & a, bind_t<R, F, L> const & b)
|
#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||||
|
|
||||||
|
// put overloads in _bi, rely on ADL
|
||||||
|
|
||||||
|
# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
|
||||||
|
template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
|
||||||
{
|
{
|
||||||
return a.compare(b);
|
return a.compare(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class R, class F, class L> bool operator!=(bind_t<R, F, L> const & a, bind_t<R, F, L> const & b)
|
# else
|
||||||
|
|
||||||
|
template<class R, class F, class L> bool function_equal_impl( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
|
||||||
{
|
{
|
||||||
return !a.compare(b);
|
return a.compare(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
|
||||||
|
#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||||
|
|
||||||
|
// put overloads in boost
|
||||||
|
|
||||||
|
} // namespace _bi
|
||||||
|
|
||||||
|
# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
|
||||||
|
template<class R, class F, class L> bool function_equal( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b )
|
||||||
|
{
|
||||||
|
return a.compare(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
template<class R, class F, class L> bool function_equal_impl( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b, int )
|
||||||
|
{
|
||||||
|
return a.compare(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
|
||||||
|
namespace _bi
|
||||||
|
{
|
||||||
|
|
||||||
|
#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||||
|
|
||||||
// add_value
|
// add_value
|
||||||
|
|
||||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
//
|
//
|
||||||
// bind_eq_test.cpp - boost::bind equality operator
|
// bind_eq_test.cpp - boost::bind equality operator
|
||||||
//
|
//
|
||||||
// Copyright (c) 2004 Peter Dimov
|
// Copyright (c) 2004, 2005 Peter Dimov
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
@@ -20,6 +20,10 @@
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/ref.hpp>
|
#include <boost/ref.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||||
|
# include <boost/function_equal.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||||
#pragma warning(push, 3)
|
#pragma warning(push, 3)
|
||||||
#endif
|
#endif
|
||||||
@@ -142,14 +146,24 @@ void fv_9(X, X, X, X, X, X, X, X, X)
|
|||||||
|
|
||||||
template<class F> void test_eq(F f1, F f2)
|
template<class F> void test_eq(F f1, F f2)
|
||||||
{
|
{
|
||||||
BOOST_TEST(f1 == f2);
|
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||||
BOOST_TEST(!(f1 != f2));
|
|
||||||
|
using boost::function_equal;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOST_TEST( function_equal( f1, f2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class F> void test_ne(F f1, F f2)
|
template<class F> void test_ne(F f1, F f2)
|
||||||
{
|
{
|
||||||
BOOST_TEST(f1 != f2);
|
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||||
BOOST_TEST(!(f1 == f2));
|
|
||||||
|
using boost::function_equal;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOST_TEST( !function_equal( f1, f2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0
|
// 0
|
||||||
|
Reference in New Issue
Block a user