Why not compare two addresses directly? #5679
lindianfeng
started this conversation in
General
Replies: 1 comment 1 reply
-
It's not an equality comparison, it's a three-way compare. Since Transmission is C++17 we don't have the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
int tr_address::compare(tr_address const& that) const noexcept // <=>
{
// IPv6 addresses are always "greater than" IPv4
if (this->type != that.type)
{
return this->is_ipv4() ? 1 : -1;
}
}
why the cmpare the ipv4 is not this->addr.addr4.s_addr == that.addr.addr4.s_addr ?
Beta Was this translation helpful? Give feedback.
All reactions