On Tuesday, 7 July 2015 at 12:33:23 UTC, Per Nordlöw wrote:
On Tuesday, 7 July 2015 at 12:29:04 UTC, Rikki Cattermole wrote:
size_t count;
AVStream* thePtr;
AVStream[] array = thePtr[0 .. count];
That should work.
Thanks.
Will that reuse the existing allocate memory at `thePtr` for
internal storage of the D array? If so how is the GC aware of
this memory?
Is there any tutorials, reference documentation, etc on these
matters?
Slicing never* allocates a new array. The GC is only aware of
memory it allocates itself and memory it is explicitly told about
(see core.memory)
Slicing pointers etc. should all be covered in
http://dlang.org/arrays.html,
http://dlang.org/d-array-article.html,
http://ddili.org/ders/d.en/arrays.html and
http://ddili.org/ders/d.en/slices.html
*unless you're using operator overloading, in which case it can
do anything of course