Algorithms and slices
Dmitry Olshansky
dmitry.olsh at gmail.com
Fri Aug 26 12:29:46 PDT 2011
On 26.08.2011 22:24, Mafi wrote:
> The algorithms in std.algorithm are great. They operate the same on
> arrays/slices and generic ranges. But they return their own range-types.
> Often this ok but sometimes you need a T[]. You may say to just use
> array() but this allocates a new array! I think you sometimes want to
> get a slice to the original array. I wrote this function. It checks if
> it is ok what it is doing at runtime.
>
I'd argue that functions in question should return slice if the input
range is sliceable. IIRC they do this when possible e.g. as in find but
not filter, am I missing something?
---
Dmitry Olshansky
More information about the Digitalmars-d
mailing list