Slices and Dynamic Arrays

Adam D. Ruppe destructionator at gmail.com
Fri Dec 29 22:38:22 UTC 2017


On Friday, 29 December 2017 at 22:32:01 UTC, Tony wrote:
> Based on those two web pages it appears that the name for a 
> dynamic array <reference?> in D is "slice". That is, anytime 
> you have a dynamic array (even a null reference version) it is 
> called a slice. Is that correct?

Not exactly, but basically. read this for a bit more info 
https://dlang.org/d-array-article.html


A slice is a bit more general than a dynamic array. You can slice 
into a static array, or any buffer really. The slice just also 
acts as a dynamic array and can create one on-demand if you 
append to it, and also slices are how D represents the underlying 
dynamic arrays to user code.


More information about the Digitalmars-d-learn mailing list