opEquals default behaviour - poorly documented or am I missing something?
user123ABCabc via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 17 12:25:30 PST 2015
On Tuesday, 17 November 2015 at 19:44:36 UTC, Ali Çehreli wrote:
> if (typeid(a) == typeid(b)) return a.opEquals(b);
Wow this is terrible to compare two objects in D. The line I
quoted means that two TypeInfoClass are likely to be allocated,
right ?
But usually when comparing objects one rather cares about the
reference itself, so a comparison of the two heap addresses is
enough in this case. (meaning same or not same instance,
regardless of the their members values).
More information about the Digitalmars-d-learn
mailing list