Hello, folks! Newbie to D, have some questions!

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 20 09:43:22 PST 2017


On 02/20/2017 07:00 AM, timmyjose wrote:

 > slice can be spawned off into a brand new array upon assigning data to
 > it (in the book "Learning D", which I find very nice so far).

It's not assigning data to a slice, but adding elements to it: It *may* 
spawn off a new array. You can use .capacity to see whether that will be 
the case:

   http://ddili.org/ders/d.en/slices.html#ix_slices..capacity

Related to your earlier question on multi-dimensional array syntax, 
which you seem to find "brilliant": :)

 
http://ddili.org/ders/d.en/slices.html#ix_slices.multi-dimensional%20array

Also, there is the following article which explains the inner workings 
of slices:

   https://dlang.org/d-array-article.html

Ali



More information about the Digitalmars-d-learn mailing list