ndslice and RC containers
Ilya Yaroshenko via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 22 07:18:07 PDT 2016
On Thursday, 22 September 2016 at 13:30:28 UTC, ZombineDev wrote:
> On Thursday, 22 September 2016 at 12:38:57 UTC, Nordlöw wrote:
>> [...]
>
> ndslice (i.e. Slice(size_t N, Range) ) is a generalization of
> D's built-in slices (i.e. T[]) to N dimensions. Just like them,
> it doesn't handle memory ownership - it just provides a view
> over existing data. Usually, there are two use cases:
> 1) Wrapping an existing array:
> 1.1) You allocate an array however you want (GC, RC, plain
> malloc)
> or just use a slice to an array returned from a
> third-party library
> 1.2) Wrap it via sliced [1]
> 1.3) Use it
> 1.4) Free it:
> 1.4.a) Let the GC reclaim it
> 1.4.b) Let the RC reclaim it
> 1.4.c) Free it manually.
>
> [...]
Thank you ZombineDev, good answer!
More information about the Digitalmars-d-learn
mailing list