Skip to content

Commit

Permalink
Added opEquals to InternetAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
marler8997 committed Jan 4, 2015
1 parent fcca276 commit 422cf57
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 422cf57

Please sign in to comment.