I wrote a function that accepts input ranges, and I get compile errors when passing an array
Seb via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 28 09:25:02 PDT 2016
On Friday, 27 May 2016 at 14:59:25 UTC, Adam D. Ruppe wrote:
> On Friday, 27 May 2016 at 14:54:30 UTC, pineapple wrote:
>> I've encountered one remarkable difference: The phobos
>> function accepts arrays and mine does not.
>
> add `import std.array;` i think to your module and it should
> make arrays ranges
you would get a more fine-grained import with
std.range (or more even more detailed std.range.primitives).
If you are interested how it works under the hood - it's pretty
simple & elegant:
https://github.com/dlang/phobos/blob/master/std/range/primitives.d#L2038
More information about the Digitalmars-d-learn
mailing list