Skip to content

Commit

Permalink
Merge pull request #2839 from marler8997/OpEquals
Browse files Browse the repository at this point in the history
Added opEquals to InternetAddress
  • Loading branch information
AndrejMitrovic committed Jan 4, 2015
2 parents fcca276 + 422cf57 commit 79d5b09
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions std/socket.d
Expand Up @@ -1662,6 +1662,23 @@ public:
}
}

/**
* Compares with another InternetAddress of same type for equality
* Returns: true if the InternetAddresses share the same address and
* port number.
* Examples:
* --------------
* InternetAddress addr1,addr2;
* if (addr1 == addr2) { }
* --------------
*/
override bool opEquals(Object o) const
{
auto other = cast(InternetAddress)o;
return other && this.sin.sin_addr.s_addr == other.sin.sin_addr.s_addr &&
this.sin.sin_port == other.sin.sin_port;
}

/**
* Parse an IPv4 address string in the dotted-decimal form $(I a.b.c.d)
* and return the number.
Expand Down

0 comments on commit 79d5b09

Please sign in to comment.