Re: A question regarding Array capacity, length and slices

2014-05-29 Thread Sourav via Digitalmars-d-learn
Thanks! Just what I needed to understand. :-) On Thursday, 29 May 2014 at 08:12:10 UTC, Ali Çehreli wrote: On 05/29/2014 12:37 AM, Sourav wrote: > the behavior totally depends upon how many > elements were present initially in the array, which means, the capacity > of a slice can actually intro

Re: A question regarding Array capacity, length and slices

2014-05-29 Thread Ali Çehreli via Digitalmars-d-learn
On 05/29/2014 12:37 AM, Sourav wrote: > the behavior totally depends upon how many > elements were present initially in the array, which means, the capacity > of a slice can actually introduces little surprises in the code! Is this > expected behavior or am I entirely missing something here? It

A question regarding Array capacity, length and slices

2014-05-29 Thread Sourav via Digitalmars-d-learn
Hello, I am quite new to D and working my way through the D tutorials. While learning about slices and capacity I found that depending upon the initial number of elements in a slice (and hence its capacity) the behavior of the code changes. Consider this program: import std.stdio; void mai