InternetAddress comparison fail
David Eagen via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 2 19:11:03 PST 2015
On Saturday, 3 January 2015 at 01:16:39 UTC, Jonathan Marler
wrote:
> Why doesn't the equals operator work on the InternetAddress
> class?
>
> import std.stdio;
> import std.socket;
> void main()
> {
> auto addr1 = new InternetAddress("192.168.0.1", 80);
> auto addr2 = new InternetAddress("192.168.0.1", 80);
> assert(addr1 == addr2); // FAILS
> }
>
> If I am not mistaken, the == operator is overriden by the
> opEquals method. I don't see any opEquals method in std.socket
> so I'm wondering if this is by design or someone overlooked it?
I ran into this too and made a helper to do the comparison (using
toAddrString) so I could move forward with my project.
Adding opEquals and opCmp is probably low-hanging fruit and a
good place for someone to start working on Phobos.
More information about the Digitalmars-d
mailing list