diff --git a/include/boost/shared_ptr.hpp b/include/boost/shared_ptr.hpp index 76ecdbb..bcc6b9d 100644 --- a/include/boost/shared_ptr.hpp +++ b/include/boost/shared_ptr.hpp @@ -225,6 +225,17 @@ template inline bool operator!=(shared_ptr const & a, return a.get() != b.get(); } +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) +{ + return a.get() != b.get(); +} + +#endif + template inline bool operator<(shared_ptr const & a, shared_ptr const & b) { return std::less()(a.get(), b.get()); diff --git a/include/boost/weak_ptr.hpp b/include/boost/weak_ptr.hpp index 2b7120e..fae6c4d 100644 --- a/include/boost/weak_ptr.hpp +++ b/include/boost/weak_ptr.hpp @@ -164,6 +164,17 @@ template inline bool operator!=(weak_ptr const & a, weak_pt return a.get() != b.get(); } +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template inline bool operator!=(weak_ptr const & a, weak_ptr const & b) +{ + return a.get() != b.get(); +} + +#endif + template inline bool operator<(weak_ptr const & a, weak_ptr const & b) { return a.less(b); diff --git a/shared_ptr_test.cpp b/shared_ptr_test.cpp index dc1282a..0ad4323 100644 --- a/shared_ptr_test.cpp +++ b/shared_ptr_test.cpp @@ -108,22 +108,10 @@ template void test_is_Y(T const & p) BOOST_TEST((*p).id() == 2); } -// std::rel_ops::operator!= breaks x != y when defined in the global namespace - -#if defined(__STL_BEGIN_RELOPS_NAMESPACE) && !defined(__STL_USE_NAMESPACE_FOR_RELOPS) -# define BOOST_BROKEN_INEQUALITY -#endif - template void test_eq(T const & a, T const & b) { BOOST_TEST(a == b); - -#ifndef BOOST_BROKEN_INEQUALITY - BOOST_TEST(!(a != b)); - -#endif - BOOST_TEST(!(a < b)); BOOST_TEST(!(b < a)); } @@ -131,13 +119,7 @@ template void test_eq(T const & a, T const & b) template void test_ne(T const & a, T const & b) { BOOST_TEST(!(a == b)); - -#ifndef BOOST_BROKEN_INEQUALITY - BOOST_TEST(a != b); - -#endif - BOOST_TEST(a < b || b < a); BOOST_TEST(!(a < b && b < a)); } @@ -145,25 +127,13 @@ template void test_ne(T const & a, T const & b) template void test_eq2(T const & a, U const & b) { BOOST_TEST(a == b); - -#ifndef BOOST_BROKEN_INEQUALITY - BOOST_TEST(!(a != b)); - -#endif - } template void test_ne2(T const & a, U const & b) { BOOST_TEST(!(a == b)); - -#ifndef BOOST_BROKEN_INEQUALITY - BOOST_TEST(a != b); - -#endif - } int test_main(int, char * [])