Could use some help with porting problems

Roderick Gibson kniteli at gmail.com
Tue Feb 7 20:33:08 PST 2012


On 2/7/2012 7:58 PM, Daniel Murphy wrote:
> It seems the problem you've run into is that a class reference cannot be
> tail-const.
>
> Pointers can be tail-const like this:
> const(Data)*
> but there is no way currently (there are proposals) to make only the data
> and not the reference const.
>
> A workaround is to use Rebindable in std.typecons.
>
> An array of references to const classes becomes:
> (Rebindable!const(Class))[]
>
>

Thanks, both answers mentioned Rebindable, looks like it may be very 
useful. I actually did use the const(Class)* solution, which puts the 
referencing requirement on the caller, but that's not a huge deal.


More information about the Digitalmars-d-learn mailing list