Denest operator< for clarity
This commit is contained in:
parent
4d8f9ea821
commit
3b44ef70b6
src/io
@ -44,13 +44,15 @@ struct Address {
|
||||
|
||||
/// unique_id is most dominant for ordering, then last_known_ip, then last_known_port
|
||||
bool operator<(const Address &other) const {
|
||||
if (unique_id == other.unique_id) {
|
||||
if (last_known_ip == other.last_known_ip) {
|
||||
return last_known_port < other.last_known_port;
|
||||
}
|
||||
if (unique_id != other.unique_id) {
|
||||
return unique_id < other.unique_id;
|
||||
}
|
||||
|
||||
if (last_known_ip != other.last_known_ip) {
|
||||
return last_known_ip < other.last_known_ip;
|
||||
}
|
||||
return unique_id < other.unique_id;
|
||||
|
||||
return last_known_port < other.last_known_port;
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
|
@ -44,13 +44,15 @@ struct PromiseKey {
|
||||
|
||||
public:
|
||||
bool operator<(const PromiseKey &other) const {
|
||||
if (requester_address == other.requester_address) {
|
||||
if (request_id == other.request_id) {
|
||||
return replier_address < other.replier_address;
|
||||
}
|
||||
if (requester_address != other.requester_address) {
|
||||
return requester_address < other.requester_address;
|
||||
}
|
||||
|
||||
if (request_id != other.request_id) {
|
||||
return request_id < other.request_id;
|
||||
}
|
||||
return requester_address < other.requester_address;
|
||||
|
||||
return replier_address < other.replier_address;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user