Cast ptr/len to D-style array
Ali Çehreli
acehreli at yahoo.com
Fri May 3 09:42:41 UTC 2019
On 05/02/2019 08:21 PM, James Blachly wrote:
> On 5/2/19 4:05 PM, ag0aep6g wrote:
>> Just slice the pointer with the length:
>>
>> int* ptr;
>> size_t len;
>> int[] arr = ptr[0 .. len];
>
> Perfect thanks. I searched but without using the magic word "slice" I
> couldn't find meaningful results.
>
> Thanks again.
Looks like I indexed it under "slice from pointer":
http://ddili.org/ders/d.en/pointers.html#ix_pointers.slice%20from%20pointer
Ali
More information about the Digitalmars-d-learn
mailing list