Copying copy?

Ali Çehreli acehreli at yahoo.com
Thu Jul 25 22:24:00 PDT 2013


On 07/25/2013 04:55 PM, bearophile wrote:
> Range-based functions see strings and char[] to arrays of dchar, but is
> that behavour good for std.algorithm.copy too?
>
> I find this a bit silly:
>
>
> import std.algorithm: copy;
> void main() {
>      char[5] arr1 = "hello", arr2;
>      arr1[].copy(arr2[]); // Error.
>      dchar[arr1.length] arr3;
>      arr1[].copy(arr3[]); // OK.
> }
>
>
> What do you think?
>
> Bye,
> bearophile

I agree. I would expect copy to maintain the same type.

Ali



More information about the Digitalmars-d-learn mailing list