Re: making a struct an inputRange with free functions

2018-04-19 Thread jmh530 via Digitalmars-d-learn
On Thursday, 19 April 2018 at 01:33:26 UTC, Jonathan M Davis wrote: [snip] Occasionally, that aspect of importing and UFCS can be annoying, but on the whole, I don't really see why it matters much, particularly when actually having the free functions available would be an enormous change to

Re: making a struct an inputRange with free functions

2018-04-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, April 18, 2018 20:39:46 jmh530 via Digitalmars-d-learn wrote: > On Monday, 16 April 2018 at 19:27:28 UTC, Jonathan M Davis wrote: > > [snip] > > It really would be nice if it worked with free functions... > > I was trying to get the example working with Atila's concepts > library

Re: making a struct an inputRange with free functions

2018-04-18 Thread jmh530 via Digitalmars-d-learn
On Monday, 16 April 2018 at 19:27:28 UTC, Jonathan M Davis wrote: [snip] It really would be nice if it worked with free functions... I was trying to get the example working with Atila's concepts library [1]. I tried re-writing the checkInputRange function so that UFCS is only used when

Re: making a struct an inputRange with free functions

2018-04-16 Thread Johannes Loher via Digitalmars-d-learn
Am 16.04.2018 um 21:27 schrieb Jonathan M Davis: > On Monday, April 16, 2018 21:10:03 Johannes Loher via Digitalmars-d-learn > wrote: >> Is there a way to do this? Here is a naive implementation: >> https://run.dlang.io/is/JKvL80 . >> >> It does not pass `isInputRange` (I think, because the free

Re: making a struct an inputRange with free functions

2018-04-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/16/18 3:10 PM, Johannes Loher wrote: Is there a way to do this? Here is a naive implementation: https://run.dlang.io/is/JKvL80 . It does not pass `isInputRange` (I think, because the free functions are not visible in the scope of `isInputRange`). You are correct, it's not possible.

Re: making a struct an inputRange with free functions

2018-04-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 16, 2018 21:10:03 Johannes Loher via Digitalmars-d-learn wrote: > Is there a way to do this? Here is a naive implementation: > https://run.dlang.io/is/JKvL80 . > > It does not pass `isInputRange` (I think, because the free functions are > not visible in the scope of

making a struct an inputRange with free functions

2018-04-16 Thread Johannes Loher via Digitalmars-d-learn
Is there a way to do this? Here is a naive implementation: https://run.dlang.io/is/JKvL80 . It does not pass `isInputRange` (I think, because the free functions are not visible in the scope of `isInputRange`). Trying to iterate over it with a foreach loop results in a compile error: Error: