Working with ranges: mismatched function return type inference

orip via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 11 08:46:20 PDT 2016


On Tuesday, 11 October 2016 at 13:06:37 UTC, pineapple wrote:
> Rewrite `return chain(ints[0..5], ints[8..$]);` as `return 
> ints[0..5] ~ ints[8..$];`
>
> The `chain` function doesn't return an array, it returns a 
> lazily-evaluated sequence of an entirely different type from 
> `int[]`.

Of course it does! I would like the function to return an "input 
range of int", no matter which one specifically. Is this possible?


More information about the Digitalmars-d-learn mailing list