Is there a way to disable copying of an alias this'd member? - trying to make a NotNull type
aliak
something at something.com
Fri May 24 12:14:06 UTC 2019
On Friday, 24 May 2019 at 12:03:08 UTC, Simen Kjærås wrote:
> On Friday, 24 May 2019 at 11:40:20 UTC, aliak wrote:
>> It's ref so that you can do this for e.g.
>>
>> class C { int i; }
>> auto a = notNull!C;
>> a.i = 3;
>
> That's a valid concern for a struct, but classes are already
> reference types, so you're only adding a new layer of ref-ness.
> The above will work great with a non-ref alias this.
>
>
> --
> Simen
Ah true. Yes I guess I can do this for ref types indeed. And
maybe I can just constrain it to classes, interfaces and pointers
🤔
Cheers,
- Ali
More information about the Digitalmars-d-learn
mailing list