const debacle

Janice Caron caron800 at googlemail.com
Sun Mar 23 02:03:51 PDT 2008


On 23/03/2008, Janice Caron <caron800 at googlemail.com> wrote:
> I don't think it's a broken concept. In fact, I think that what
>  Stephen wants is completely reasonable and useful.

Stephen, I think this does the trick.

    T f(T : const(char)[])(T a)
    {
        return a[1..$];
    }

    private alias f!(const(char)[]) dummy;

The alias forces an instantiation for T == const(char)[], and if that
compiles, then the function does not modify its input.



More information about the Digitalmars-d mailing list