Can someone please explain why the following assertion fails?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 1 07:06:08 PDT 2016


On 10/31/16 3:08 PM, Gary Willoughby wrote:
> Can someone please explain why the following assertion fails?
>
> import std.stdio;
> import std.conv;
>
> void main(string[] args)
> {
>     auto x = 1;
>
>     assert(hashOf(x.to!(string)) == hashOf(x.to!(string)));
> }
>
> Thanks.

IMO, it shouldn't. A string's "value" has nothing to do with it's location.

-Steve


More information about the Digitalmars-d-learn mailing list