constancy and template parameters in D2.009+

Janice Caron caron800 at googlemail.com
Thu Dec 13 03:01:29 PST 2007


On 12/13/07, Janice Caron <caron800 at googlemail.com> wrote:
> And you could use a template for the second situation:
>
>         alias RemoveHeadConst!(T) U;
>
> to mean U is T with head constancy removed (that is, const(int)
> becomes just int).

I think the template idea actually works. You could implement it in
std.typecons as

template RemoveHeadConst(T) { alias T RemoveHeadConst; }

It ought to work because the parameter has been expressed as (T), not
(T:T), or my suggested (init T). If that works, one of the two
problems is solved without /any/ modification to the language.

That just leaves (1)...



More information about the Digitalmars-d mailing list