This one weird trick allows you to capture loop variables.
Walter Bright
newshound2 at digitalmars.com
Mon Oct 21 03:41:03 UTC 2024
On 10/20/2024 3:45 PM, Timon Gehr wrote:
> As someone who has also implemented `opApply`, I do think it is quite
> straightforward. It's just internal iteration with support for multiple ways to
> exit the loop, encoded using numerical indices.
That's because you're smarter than I am, Timon. And I'm not joking.
I implemented it as a way to deal with visiting each node of a binary tree.
Doing that with a range is clunky and unappealing.
More information about the Digitalmars-d
mailing list