mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
LibCore: Add Traits<Core::SocketAddress>::hash()
This commit is contained in:
parent
d185217599
commit
fc065ee560
1 changed files with 11 additions and 0 deletions
|
@ -84,6 +84,9 @@ public:
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==(SocketAddress const& other) const = default;
|
||||||
|
bool operator!=(SocketAddress const& other) const = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type m_type { Type::Invalid };
|
Type m_type { Type::Invalid };
|
||||||
IPv4Address m_ipv4_address;
|
IPv4Address m_ipv4_address;
|
||||||
|
@ -100,3 +103,11 @@ struct AK::Formatter<Core::SocketAddress> : Formatter<DeprecatedString> {
|
||||||
return Formatter<DeprecatedString>::format(builder, value.to_deprecated_string());
|
return Formatter<DeprecatedString>::format(builder, value.to_deprecated_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct AK::Traits<Core::SocketAddress> : public GenericTraits<Core::SocketAddress> {
|
||||||
|
static unsigned hash(Core::SocketAddress const& socket_address)
|
||||||
|
{
|
||||||
|
return pair_int_hash(Traits<IPv4Address>::hash(socket_address.ipv4_address()), Traits<u16>::hash(socket_address.port()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue