how is this array subtyping inside struct (bug?) possible?
Avrina
avrina12309412342 at gmail.com
Tue Aug 11 14:26:00 UTC 2020
On Monday, 10 August 2020 at 21:15:58 UTC, mw wrote:
> On Monday, 10 August 2020 at 20:34:33 UTC, kinke wrote:
>>> This does not work:
>>
>> This does and prints the desired output:
>>
>> class SharedArray(T)
>> {
>> T[] array;
>> alias array this;
>>
>> final @disable:
>> T front();
>> void popFront();
>> bool empty();
>> }
>>
>> https://run.dlang.io/is/5ciCue
>
> Thanks. I will accept this as the proper work-around.
There really shouldn't be a workaround, this just outlines that
there's an ordering problem in writeln. It should be using
front/popfront as a last resort if it isn't able to use another
(better) method.
More information about the Digitalmars-d
mailing list