I wrote a function that accepts input ranges, and I get compile errors when passing an array

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 28 13:43:00 PDT 2016


On Saturday, 28 May 2016 at 16:25:02 UTC, Seb wrote:
> If you are interested how it works under the hood - it's pretty 
> simple & elegant:

I checked up on the phobos implementation and found that arrays 
are mutated when iterated over as ranges, which didn't rest well 
with me. Nor did the idea of importing some module having such a 
significant side-effect as whether some type can act as a range 
or not. So I ended up making a sort of factory that turns 
arbitrary objects into ranges, including arrays. Seems to work 
pretty well.


More information about the Digitalmars-d-learn mailing list