The Status of Const
Steven Schveighoffer
schveiguy at yahoo.com
Mon Aug 16 08:41:37 PDT 2010
On Mon, 16 Aug 2010 11:30:10 -0400, Michel Fortin
<michel.fortin at michelf.com> wrote:
> On 2010-08-16 11:23:24 -0400, Michel Fortin <michel.fortin at michelf.com>
> said:
>
>> Shouldn't this work?
>> struct Array(V) {
>> uint length;
>> V *v;
>> Array!(const V) _const() @property { ... }
>> alias _const this;
>> }
>
> Well, it doesn't, but perhaps it should.
>
> I agree that implicit conversions is the core of the problem for
> tail-const in structs.
If the mechanism isn't automatic, and involves doing stuff like this, I
don't see it being used much. The compiler has to help here somewhere.
-Steve
More information about the Digitalmars-d
mailing list