Slices and Dynamic Arrays

Tony tonytdominguez at aol.com
Sun Dec 31 14:49:40 UTC 2017


On Sunday, 31 December 2017 at 14:24:40 UTC, Jonathan M Davis 
wrote:

>
> The D Slices article does an excellent job of explaining all of 
> this. It's just that it calls the GC-allocated memory buffer 
> the dynamic array instead of calling T[] the dynamic array like 
> the language and spec do. Regardless, all non-null dynamic 
> arrays are slices of memory.

The DLang Tour also uses the term slice to refer to T[].

"The type of arr is int[], which is also called a slice."

"A slice consists of two members - a pointer to the starting 
element and the length of the slice:"






More information about the Digitalmars-d-learn mailing list