Add operator< for InfoHash class

This commit is contained in:
Chocobo1
2020-12-10 15:58:54 +08:00
committed by sledgehammer999
parent e4e55d2a80
commit 7de983b4e5
3 changed files with 8 additions and 2 deletions

View File

@@ -84,6 +84,11 @@ bool BitTorrent::operator!=(const InfoHash &left, const InfoHash &right)
return !(left == right);
}
bool BitTorrent::operator<(const InfoHash &left, const InfoHash &right)
{
return static_cast<lt::sha1_hash>(left) < static_cast<lt::sha1_hash>(right);
}
uint BitTorrent::qHash(const InfoHash &key, const uint seed)
{
return ::qHash((std::hash<lt::sha1_hash> {})(key), seed);