Explicit Slicing of std.container.Array
Tobias Pankrath via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 24 05:59:12 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.
Because container are no ranges. If they were ranges, what would
array.popFront() do?
More information about the Digitalmars-d-learn
mailing list