learn some d those days, can't understand the code here

sigod via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 13 09:47:15 PST 2016


On Friday, 12 February 2016 at 20:13:16 UTC, Junfeng wrote:
> a quick search, seem we should write it like:
>
> t[] to = (cast(T*)allocator.allocate(T.sizeof * from.length))[0 
> .. from.length]);
>
> but after this modify, it will crash at
>          to[] = from[];

Shouldn't you use [`makeArray`][0] in this case?

[0]: 
http://dlang.org/phobos/std_experimental_allocator.html#.makeArray


More information about the Digitalmars-d mailing list