InternetAddress comparison fail

MattCoder via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 2 17:59:38 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?

It fails as the example below:

import std.stdio;

class foo{}
void main(){
   auto a = new foo;
   auto b = new foo;
   assert(a == b);
}

I believe you need to compare the values inside those class right?

Anyway, the way I'd do this is changing the line:

assert(addr1 == addr2); // FAILS

to

assert(addr1.toAddrString() == addr2.toAddrString());

Matheus.


More information about the Digitalmars-d mailing list