genealize arithmetic operators for socket_base and derived (#470)

Generalize arithmetic operators for socket_base and derived
This commit is contained in:
albestro 2021-03-10 22:20:33 +01:00 committed by GitHub
parent f428fee374
commit 1a4ebda46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

16
zmq.hpp
View File

@ -2083,27 +2083,27 @@ inline bool operator!=(std::nullptr_t /*p*/, socket_ref sr) ZMQ_NOTHROW
}
#endif
inline bool operator==(socket_ref a, socket_ref b) ZMQ_NOTHROW
inline bool operator==(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW
{
return std::equal_to<void *>()(a.handle(), b.handle());
return std::equal_to<const void *>()(a.handle(), b.handle());
}
inline bool operator!=(socket_ref a, socket_ref b) ZMQ_NOTHROW
inline bool operator!=(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW
{
return !(a == b);
}
inline bool operator<(socket_ref a, socket_ref b) ZMQ_NOTHROW
inline bool operator<(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW
{
return std::less<void *>()(a.handle(), b.handle());
return std::less<const void *>()(a.handle(), b.handle());
}
inline bool operator>(socket_ref a, socket_ref b) ZMQ_NOTHROW
inline bool operator>(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW
{
return b < a;
}
inline bool operator<=(socket_ref a, socket_ref b) ZMQ_NOTHROW
inline bool operator<=(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW
{
return !(a > b);
}
inline bool operator>=(socket_ref a, socket_ref b) ZMQ_NOTHROW
inline bool operator>=(const detail::socket_base& a, const detail::socket_base& b) ZMQ_NOTHROW
{
return !(a < b);
}