Re: foreach seems to work with opIndex()

2016-02-06 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Feb 06, 2016 at 03:11:22PM +, ZombineDev via Digitalmars-d-learn wrote: > On Saturday, 6 February 2016 at 15:02:16 UTC, H. S. Teoh wrote: > >On Sat, Feb 06, 2016 at 02:43:52PM +, Tofu Ninja via > >Digitalmars-d-learn wrote: > >>Foreach seems to work if there is an opIndex() with

Re: foreach seems to work with opIndex()

2016-02-06 Thread Tofu Ninja via Digitalmars-d-learn
On Saturday, 6 February 2016 at 15:02:16 UTC, H. S. Teoh wrote: Not really sure, but opIndex() with no arguments is supposed to be the current way of implement the [] slicing operator for user-defined types. I'm not sure when foreach started supporting that, but it's certainly a nice thing!

Re: foreach seems to work with opIndex()

2016-02-06 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 6 February 2016 at 15:02:16 UTC, H. S. Teoh wrote: On Sat, Feb 06, 2016 at 02:43:52PM +, Tofu Ninja via Digitalmars-d-learn wrote: Foreach seems to work if there is an opIndex() with no arguments that returns a range interface, is this documented? I can't seem to find anything

Re: foreach seems to work with opIndex()

2016-02-06 Thread anonymous via Digitalmars-d-learn
On 06.02.2016 15:43, Tofu Ninja wrote: Foreach seems to work if there is an opIndex() with no arguments that returns a range interface, is this documented? I can't seem to find anything that say this is supposed to happen. I am not really complaining, its nice, but I just didnt really expect it

Re: foreach seems to work with opIndex()

2016-02-06 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Feb 06, 2016 at 02:43:52PM +, Tofu Ninja via Digitalmars-d-learn wrote: > Foreach seems to work if there is an opIndex() with no arguments that > returns a range interface, is this documented? I can't seem to find > anything that say this is supposed to happen. I am not really >

Re: foreach seems to work with opIndex()

2016-02-06 Thread Tofu Ninja via Digitalmars-d-learn
On Saturday, 6 February 2016 at 14:43:52 UTC, Tofu Ninja wrote: Foreach seems to work if there is an opIndex() with no arguments that returns a range interface, is this documented? I can't seem to find anything that say this is supposed to happen. I am not really complaining, its nice, but I

foreach seems to work with opIndex()

2016-02-06 Thread Tofu Ninja via Digitalmars-d-learn
Foreach seems to work if there is an opIndex() with no arguments that returns a range interface, is this documented? I can't seem to find anything that say this is supposed to happen. I am not really complaining, its nice, but I just didnt really expect it because I feel like I remember this