Why isn't == used to compare structs
Steven Schveighoffer
schveiguy at yahoo.com
Tue Feb 9 12:09:48 PST 2010
On Tue, 09 Feb 2010 14:58:13 -0500, grauzone <none at example.net> wrote:
> Don wrote:
>> Trass3r wrote:
>>>> Why isn't == used to compare the struct members in the code above? I
>>>> mean, if I compare the structs with == it could also use == to
>>>> compare the members. If I use "is" to compare the structs it could
>>>> use "is" to compare them members.
>>>
>>> Structs are compared *bitwise*!
>> Not in D2, any more. If a member has an opEquals, it's compared using
>> ==.
>
> Seems arrays inside structs still are not compared with ==.
http://d.puremagic.com/issues/show_bug.cgi?id=3789
More information about the Digitalmars-d-learn
mailing list