Re: How to get array length

2014-05-25 Thread kaz via Digitalmars-d-learn
On Thursday, 22 May 2014 at 23:24:30 UTC, Brad Anderson wrote: On Thursday, 22 May 2014 at 23:22:44 UTC, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. Just use .length: void main() { import std.stdio; auto a = new int[5];

Re: How to get array length

2014-05-25 Thread kaz via Digitalmars-d-learn
On Thursday, 22 May 2014 at 23:26:02 UTC, Ali Çehreli wrote: On 05/22/2014 04:22 PM, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. If you mean the length of the original array, no. Of course, the length of the slice is trivial: slice.length. The

Re: How to get array length

2014-05-25 Thread Rene Zwanenburg via Digitalmars-d-learn
On Sunday, 25 May 2014 at 06:50:14 UTC, kaz wrote: On Thursday, 22 May 2014 at 23:26:02 UTC, Ali Çehreli wrote: On 05/22/2014 04:22 PM, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. If you mean the length of the original array, no. Of course, the

Re: How to get array length

2014-05-22 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 22 May 2014 at 23:22:44 UTC, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. Just use .length: void main() { import std.stdio; auto a = new int[5]; auto b = a[]; writeln(a.length, , b.length); }

Re: How to get array length

2014-05-22 Thread Ali Çehreli via Digitalmars-d-learn
On 05/22/2014 04:22 PM, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. If you mean the length of the original array, no. Of course, the length of the slice is trivial: slice.length. The following article explains how slices don't know about other