D Language Dynamic Arrays & Slices

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


  • <type>[] <name>;


Slices generate a new view on existing memory. They don't create a new copy. If no slice holds a reference to that memory anymore - or a sliced part of it - it will be freed by the garbage collector.

Using slices it's possible to write very efficient code for e.g. parsers that just operate on one memory block and just slice the parts they really need to work on - no need allocating new memory blocks.

Got any D Language Question?