ubyte[] -> immutable(ubyte)[]

Andrej Mitrovic test at test.test
Fri Sep 10 08:14:34 PDT 2010


Ah, idup. Too obvious, but I missed it. Thanks.

Pelle Wrote:

> std.algorithm.copy will copy an input range into an output range. An 
> array is a valid output range, but does not append as you seem to 
> expect. Instead, it fills the array.
> 
> int[] a = new int[](3);
> copy([1,2,3],a);
> assert (a == [1,2,3]);
> 
> To get an output range which appends to an array, use appender.
> 
> In this case, however, you simply want buffer.idup; :-)



More information about the Digitalmars-d-learn mailing list