Add additional foreach mechanism to range page

Issue #33 new
Steven Schveighoffer created an issue

On the page http://ddili.org/ders/d.en/foreach_opapply.html, there is one further mechanism that is not discussed. You have listed:

  1. adding range functions
  2. using opApply

There is actually a third way to hook this (actually there is a fourth, using a delegate, but this one is more likely): If you return a range using the empty opSlice function, and the other options are not present, then foreach(...; obj) will try to initialize a range using obj[] and iterate as if you did that.

I don’t really see a part of the spec that talks about this, I just know it does this from experience.

Comments (0)

  1. Log in to comment