Explicit Slicing of std.container.Array

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 24 07:30:34 PST 2015


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") {}
>
> ?
>
> Does memory allocation play a role?
>
> I would like to see it be used in replace of D builtin arrays 
> without any code changes.

One thing to mention in the revised docs in the introduction to 
std.algorithms.


More information about the Digitalmars-d-learn mailing list