diff --git a/src/network/utils/ipv4-address.cc b/src/network/utils/ipv4-address.cc index 6b628ff47..d4d410eae 100644 --- a/src/network/utils/ipv4-address.cc +++ b/src/network/utils/ipv4-address.cc @@ -422,7 +422,7 @@ Ipv4Address::GetLoopback (void) size_t Ipv4AddressHash::operator() (Ipv4Address const &x) const { - return x.Get (); + return std::hash()(x.Get ()); } std::ostream& operator<< (std::ostream& os, Ipv4Address const& address) diff --git a/src/network/utils/ipv4-address.h b/src/network/utils/ipv4-address.h index 9cc3ab1d6..cea58099e 100644 --- a/src/network/utils/ipv4-address.h +++ b/src/network/utils/ipv4-address.h @@ -435,12 +435,15 @@ inline bool operator < (const Ipv4Address &a, const Ipv4Address &b) * * \brief Class providing an hash for IPv4 addresses */ -class Ipv4AddressHash : public std::unary_function { +class Ipv4AddressHash { public: /** - * Returns the hash of the address + * \brief Returns the hash of an IPv4 address. * \param x the address * \return the hash + * + * This method uses std::hash rather than class Hash + * as speed is more important than cryptographic robustness. */ size_t operator() (Ipv4Address const &x) const; }; diff --git a/src/network/utils/ipv6-address.h b/src/network/utils/ipv6-address.h index 269275f3b..a9a0ca0e2 100644 --- a/src/network/utils/ipv6-address.h +++ b/src/network/utils/ipv6-address.h @@ -697,11 +697,11 @@ inline bool operator != (const Ipv6Prefix& a, const Ipv6Prefix& b) * \class Ipv6AddressHash * \brief Hash function class for IPv6 addresses. */ -class Ipv6AddressHash : public std::unary_function +class Ipv6AddressHash { public: /** - * \brief Unary operator to hash IPv6 address. + * \brief Returns the hash of an IPv6 address. * \param x IPv6 address to hash * \returns the hash of the address */