Stable D version?

Chris Cain clcain at uncg.edu
Mon Apr 22 21:26:58 PDT 2013


On Tuesday, 23 April 2013 at 03:46:30 UTC, Mehrdad wrote:
> ...
>
>
> Nope, still broken.

The behavior isn't too surprising to me. Your code is buggy. 
Defining opEquals gets you the behavior you might want:

import std.stdio, std.algorithm;
struct S {
     string a;
     bool opEquals(S rhs) { return a.equal(rhs.a); }
}
pragma(msg,  S("x") == S("x".idup));
void main() {
     writeln(S("x") == S("x".idup));
}

outputs:
true
true


More information about the Digitalmars-d mailing list