Head Const

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 18 14:48:01 PST 2016


On 2/18/2016 4:18 AM, Andrei Alexandrescu wrote:
> On 02/17/2016 05:44 PM, Walter Bright wrote:
>> It would seem that implementing headconst as a type constructor would
>> let people who wanted mutable members have their way, without
>> introducing backdoors in const.
>
> Doesn't seem that way to me, viz:
>
> struct A
> {
>      int i;
> }
>
> A __const(A) will have a __const(int) member.

struct A { int* pi; }

and *pi will be mutable even though pi is __const.



More information about the Digitalmars-d mailing list