Assigning to char[N]

bearophile bearophileHUGS at lycos.com
Wed Feb 1 16:34:11 PST 2012


Ali:

>      a["one".length .. $] = '\0';

Is DMD able to optimize that string literal away? (Some assembly may be required).


>      // copy(a, "new content");
>      // fill(a, "new content");
>      // insertInPlace(a, "new content");
>      //
>      // Those do not work with errors similar to this:
>      //
>      //   Error: template std.algorithm.copy(Range1,Range2) if
>      //   (isInputRange!(Range1) &&
>      //   isOutputRange!(Range2,ElementType!(Range1))) does not match any
>      //   function template declaration

Try harder. Try to slice that a.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list