D1.5 anyone?

Dukc ajieskola at gmail.com
Wed Apr 19 11:05:05 UTC 2023


On Wednesday, 12 April 2023 at 07:33:00 UTC, Walter Bright wrote:
> On 4/12/2023 12:05 AM, Walter Bright wrote:
>>  > Templates without extreme precautions and Unqual!T all 
>> around will get instantiated up to 3x(!) times.
>> 
>> I'm not sure why `Unqual!T` exists. `cast()T` will remove all 
>> the head qualifiers, no templates involved.
>
> Oops. That is, cast()E will remove all the qualifiers from the 
> type of E. So Unqual!T needs to exist. My mistake.

Example? My quick-and-dirty tests say that `cast() x` removes 
only the head qualifiers. Well if you have a struct with 
default-mutable members, `immutable` will be removed from the 
fields too (I think) but I don't think `Unqual!X` is different in 
that regard.

I believe the primary difference is that `cast() x` works on the 
value, while `Unqual!X` works on the type.


More information about the Digitalmars-d mailing list