Dynamic array comparison optimization: check for equal pointers?

Steven Schveighoffer schveiguy at gmail.com
Tue Jun 2 22:53:21 UTC 2020


On 6/2/20 6:48 PM, Jonathan M Davis wrote:
> On Tuesday, June 2, 2020 3:18:40 PM MDT Steven Schveighoffer via Digitalmars-d
> wrote:
>> I thought I remembered this being true, but maybe it was for class
>> instances? Looking back in history, it seems prior to 2017, it was done
>> by the compiler generating the code instead of a template, but seems
>> like it did not include the pointer check.
> 
> The free function opEquals for classes does check the references first and
> has for years (as well doing checks like whether either reference is null).
> I've never looked at what the array implementation does though.

Sorry, to be clear I meant the array implementation prior to 2017 
implemented opEquals by generating code with the compiler. After that, 
it used the linked template.

-Steve


More information about the Digitalmars-d mailing list