forked from boostorg/smart_ptr
Fix the g++ 2.9x operator!= ambiguity.
[SVN r12772]
This commit is contained in:
@ -225,6 +225,17 @@ template<typename T, typename U> inline bool operator!=(shared_ptr<T> const & a,
|
|||||||
return a.get() != b.get();
|
return a.get() != b.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96
|
||||||
|
|
||||||
|
// Resolve the ambiguity between our op!= and the one in rel_ops
|
||||||
|
|
||||||
|
template<typename T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b)
|
||||||
|
{
|
||||||
|
return a.get() != b.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename T> inline bool operator<(shared_ptr<T> const & a, shared_ptr<T> const & b)
|
template<typename T> inline bool operator<(shared_ptr<T> const & a, shared_ptr<T> const & b)
|
||||||
{
|
{
|
||||||
return std::less<T*>()(a.get(), b.get());
|
return std::less<T*>()(a.get(), b.get());
|
||||||
|
@ -164,6 +164,17 @@ template<class T, class U> inline bool operator!=(weak_ptr<T> const & a, weak_pt
|
|||||||
return a.get() != b.get();
|
return a.get() != b.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96
|
||||||
|
|
||||||
|
// Resolve the ambiguity between our op!= and the one in rel_ops
|
||||||
|
|
||||||
|
template<typename T> inline bool operator!=(weak_ptr<T> const & a, weak_ptr<T> const & b)
|
||||||
|
{
|
||||||
|
return a.get() != b.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class T> inline bool operator<(weak_ptr<T> const & a, weak_ptr<T> const & b)
|
template<class T> inline bool operator<(weak_ptr<T> const & a, weak_ptr<T> const & b)
|
||||||
{
|
{
|
||||||
return a.less(b);
|
return a.less(b);
|
||||||
|
@ -108,22 +108,10 @@ template<class T> void test_is_Y(T const & p)
|
|||||||
BOOST_TEST((*p).id() == 2);
|
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<class T> void test_eq(T const & a, T const & b)
|
template<class T> void test_eq(T const & a, T const & b)
|
||||||
{
|
{
|
||||||
BOOST_TEST(a == b);
|
BOOST_TEST(a == b);
|
||||||
|
|
||||||
#ifndef BOOST_BROKEN_INEQUALITY
|
|
||||||
|
|
||||||
BOOST_TEST(!(a != b));
|
BOOST_TEST(!(a != b));
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOST_TEST(!(a < b));
|
BOOST_TEST(!(a < b));
|
||||||
BOOST_TEST(!(b < a));
|
BOOST_TEST(!(b < a));
|
||||||
}
|
}
|
||||||
@ -131,13 +119,7 @@ template<class T> void test_eq(T const & a, T const & b)
|
|||||||
template<class T> void test_ne(T const & a, T const & b)
|
template<class T> void test_ne(T const & a, T const & b)
|
||||||
{
|
{
|
||||||
BOOST_TEST(!(a == b));
|
BOOST_TEST(!(a == b));
|
||||||
|
|
||||||
#ifndef BOOST_BROKEN_INEQUALITY
|
|
||||||
|
|
||||||
BOOST_TEST(a != b);
|
BOOST_TEST(a != b);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOST_TEST(a < b || b < a);
|
BOOST_TEST(a < b || b < a);
|
||||||
BOOST_TEST(!(a < b && b < a));
|
BOOST_TEST(!(a < b && b < a));
|
||||||
}
|
}
|
||||||
@ -145,25 +127,13 @@ template<class T> void test_ne(T const & a, T const & b)
|
|||||||
template<class T, class U> void test_eq2(T const & a, U const & b)
|
template<class T, class U> void test_eq2(T const & a, U const & b)
|
||||||
{
|
{
|
||||||
BOOST_TEST(a == b);
|
BOOST_TEST(a == b);
|
||||||
|
|
||||||
#ifndef BOOST_BROKEN_INEQUALITY
|
|
||||||
|
|
||||||
BOOST_TEST(!(a != b));
|
BOOST_TEST(!(a != b));
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class U> void test_ne2(T const & a, U const & b)
|
template<class T, class U> void test_ne2(T const & a, U const & b)
|
||||||
{
|
{
|
||||||
BOOST_TEST(!(a == b));
|
BOOST_TEST(!(a == b));
|
||||||
|
|
||||||
#ifndef BOOST_BROKEN_INEQUALITY
|
|
||||||
|
|
||||||
BOOST_TEST(a != b);
|
BOOST_TEST(a != b);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_main(int, char * [])
|
int test_main(int, char * [])
|
||||||
|
Reference in New Issue
Block a user