Re: Explicit Slicing of std.container.Array

2015-01-24 Thread Nordlöw
On Saturday, 24 January 2015 at 13:59:13 UTC, Tobias Pankrath wrote: foreach (e; a[].filter!true) {} Is a[] a no-op if a is a D normal builtin array/slice?

Re: Explicit Slicing of std.container.Array

2015-01-24 Thread Nordlöw
On Saturday, 24 January 2015 at 21:10:29 UTC, ketmar wrote: yes. the following source produces the same machine code regardless of slicing on `z` with 'dmd -c': Nice, that's what I had hoped for! Thanks.

Re: Explicit Slicing of std.container.Array

2015-01-24 Thread ketmar via Digitalmars-d-learn
On Sat, 24 Jan 2015 19:51:30 +, Nordlöw wrote: On Saturday, 24 January 2015 at 13:59:13 UTC, Tobias Pankrath wrote: foreach (e; a[].filter!true) {} Is a[] a no-op if a is a D normal builtin array/slice? yes. the following source produces the same machine code regardless of slicing

Re: Explicit Slicing of std.container.Array

2015-01-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, January 24, 2015 13:11:31 Nordlöw via Digitalmars-d-learn wrote: Is there a reason why std.container.Array have to be explicitly sliced before being processed by range algorithms such as filter typically as import std.container: Array; Array!int a; foreach (e;

Re: Explicit Slicing of std.container.Array

2015-01-24 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 24 January 2015 at 13:11:33 UTC, Nordlöw wrote: Is there a reason why std.container.Array have to be explicitly sliced before being processed by range algorithms such as filter typically as import std.container: Array; Array!int a; foreach (e; a[].filter!true) {} ?

Explicit Slicing of std.container.Array

2015-01-24 Thread Nordlöw
Is there a reason why std.container.Array have to be explicitly sliced before being processed by range algorithms such as filter typically as import std.container: Array; Array!int a; foreach (e; a[].filter!true) {} ? Does memory allocation play a role? I would like to see it be

Re: Explicit Slicing of std.container.Array

2015-01-24 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 24 January 2015 at 13:11:33 UTC, Nordlöw wrote: Is there a reason why std.container.Array have to be explicitly sliced before being processed by range algorithms such as filter typically as import std.container: Array; Array!int a; foreach (e; a[].filter!true) {} ?

Re: Explicit Slicing of std.container.Array

2015-01-24 Thread Nordlöw
On Saturday, 24 January 2015 at 15:30:36 UTC, Laeeth Isharc wrote: One thing to mention in the revised docs in the introduction to std.algorithms. https://github.com/D-Programming-Language/phobos/pull/2904 Thanks!