enum pointers or class references limitation

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 1 11:48:47 PDT 2017


On Thursday, 31 August 2017 at 14:28:57 UTC, Ali Çehreli wrote:
> On 08/31/2017 01:52 AM, Nicholas Wilson wrote:
>
>> I think Timon is referring to:
>>
>> enum int[] foo = [1,2,3];
>>
>> auto bar = foo;
>> auto baz = foo;
>>
>> assert(!(bar is baz)); // Passes
>
> Even better:
>
>     enum int[] foo = [1,2,3];
>     assert(!(foo is foo)); // Passes
>

I guess

assert(!([1,2,3] is [1,2,3]));

Which is exactly what enum expands to and totally expected. Where 
is the surprise?
> Ali




More information about the Digitalmars-d mailing list