Challenge: write a reference counted slice that works as much as possible like a built-in slice

Paolo Invernizzi paolo.invernizzi at gmail.com
Wed Nov 10 18:50:26 UTC 2021


On Wednesday, 10 November 2021 at 17:24:03 UTC, deadalnix wrote:
> On Wednesday, 10 November 2021 at 17:09:05 UTC, H. S. Teoh 
> wrote:
>> Isn't that what @disable this() is for?
>>
>> And to be pedantic, the object *was* constructed -- by the 
>> default ctor. If you didn't want that, you should @disable 
>> this().
>>
>>
>> T
>
> No.
>
> Everything that is destructed must have been constructed. It is 
> the only way you can enforce invariant within a type.

Invariants must hold also with structures initialised from 
'.init', if you don't want to @disable this()...


More information about the Digitalmars-d mailing list