Fix compiler warning

pull/1467/head
Tatsuhiro Tsujikawa 2019-09-15 11:26:48 +09:00
parent 9f5758570a
commit 80df934955
3 changed files with 6 additions and 3 deletions

View File

@ -59,7 +59,7 @@ DHTPeerAnnounceStorage::DHTPeerAnnounceStorage()
bool DHTPeerAnnounceStorage::InfoHashLess::
operator()(const std::shared_ptr<DHTPeerAnnounceEntry>& lhs,
const std::shared_ptr<DHTPeerAnnounceEntry>& rhs)
const std::shared_ptr<DHTPeerAnnounceEntry>& rhs) const
{
return memcmp(lhs->getInfoHash(), rhs->getInfoHash(), DHT_ID_LENGTH) < 0;
}

View File

@ -54,7 +54,7 @@ private:
class InfoHashLess {
public:
bool operator()(const std::shared_ptr<DHTPeerAnnounceEntry>& lhs,
const std::shared_ptr<DHTPeerAnnounceEntry>& rhs);
const std::shared_ptr<DHTPeerAnnounceEntry>& rhs) const;
};
typedef std::set<std::shared_ptr<DHTPeerAnnounceEntry>, InfoHashLess>
DHTPeerAnnounceEntrySet;

View File

@ -143,7 +143,10 @@ namespace {
template <typename T> class Unique {
typedef T type;
struct PointerCmp {
inline bool operator()(const type* x, const type* y) { return *x < *y; }
inline bool operator()(const type* x, const type* y) const
{
return *x < *y;
}
};
std::set<const type*, PointerCmp> known;