1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-28 04:34:27 +01:00

Implemented operator< on both HWAddress and IPv4Address.

This commit is contained in:
Matias Fontanini
2012-10-10 21:14:25 -03:00
parent 3139020df2
commit 5b54cdefad
4 changed files with 49 additions and 0 deletions

View File

@@ -206,6 +206,17 @@ public:
return !(*this == rhs);
}
/**
* \brief Compares this HWAddress for less-than inequality.
*
* \param rhs The HWAddress to be compared to.
*
* \return bool indicating whether this address is less-than rhs.
*/
bool operator<(const HWAddress &rhs) const {
return std::lexicographical_compare(begin(), end(), rhs.begin(), rhs.end());
}
/**
* \brief Retrieves the size of this address.
*

View File

@@ -110,6 +110,16 @@ namespace Tins {
return !(*this == rhs);
}
/**
* \brief Compare this IPv4Address for less-than inequality.
*
* \param rhs The address to be compared.
* \return bool indicating whether this address is less-than rhs.
*/
bool operator< (const IPv4Address &rhs) const {
return ip_addr < rhs.ip_addr;
}
/**
* \brief Writes this address to a std::ostream.
*