IntrusivePtr: remove ordering operators

These violate the C++ standard because comparing pointers to unrelated
objects is undefined behavior.
This commit is contained in:
Max Kellermann 2020-02-19 05:41:37 +01:00
parent 08128b244f
commit 98b27a2ae8

View file

@ -243,24 +243,6 @@ bool operator!=(const T* x, const IntrusivePtr<T>& y) {
return x != y.get(); return x != y.get();
} }
/**
* @relates IntrusivePtr
*/
template <class T>
bool operator<(const IntrusivePtr<T>& x, const T* y)
{
return x.get() < y;
}
/**
* @relates IntrusivePtr
*/
template <class T>
bool operator<(const T* x, const IntrusivePtr<T>& y)
{
return x < y.get();
}
// -- comparison to intrusive pointer ------------------------------------------ // -- comparison to intrusive pointer ------------------------------------------
// Using trailing return type and decltype() here removes this function from // Using trailing return type and decltype() here removes this function from
@ -286,13 +268,3 @@ auto operator!=(const IntrusivePtr<T>& x, const IntrusivePtr<U>& y)
return x.get() != y.get(); return x.get() != y.get();
} }
/**
* @relates IntrusivePtr
*/
template <class T>
auto operator<(const IntrusivePtr<T>& x, const IntrusivePtr<T>& y)
-> decltype(x.get() < y.get())
{
return x.get() < y.get();
}