Mercurial > code
diff C++/SocketAddress.h @ 246:9cfa6fbc9c03
Socket: add operators for SocketAddress
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 29 Sep 2014 12:57:43 +0200 |
parents | 3c12f0e8bbb9 |
children | 2096edb63a4f |
line wrap: on
line diff
--- a/C++/SocketAddress.h Sun Sep 28 21:15:26 2014 +0200 +++ b/C++/SocketAddress.h Mon Sep 29 12:57:43 2014 +0200 @@ -66,6 +66,24 @@ * @return the address */ const sockaddr_storage &address() const; + + /** + * Compare the addresses. The check is lexicographical. + * + * @param s1 the first address + * @param s2 the second address + * @return true if s1 is less than s2 + */ + friend bool operator<(const SocketAddress &s1, const SocketAddress &s2); + + /** + * Compare the addresses. + * + * @param s1 the first address + * @param s2 the second address + * @return true if s1 == s2 + */ + friend bool operator==(const SocketAddress &s1, const SocketAddress &s2); }; namespace address {