Cast ptr/len to D-style array
James Blachly
james.blachly at gmail.com
Sat May 4 19:51:31 UTC 2019
On 5/3/19 5:42 AM, Ali Çehreli wrote:
> 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
>
Thanks Ali, also helpful examples!
More information about the Digitalmars-d-learn
mailing list