Re: adding delegate to opApply

2019-09-03 Thread berni via Digitalmars-d-learn
On Monday, 2 September 2019 at 14:20:11 UTC, Paul Backus wrote: If you have an existing delegate that you want to use with opApply, the easiest way is like this: void delegate(Thing) myDelegate = ...; foreach(thing; things) { myDelegate(thing); } // Equivalent to: things.opApply((Thing t)

Re: adding delegate to opApply

2019-09-02 Thread Paul Backus via Digitalmars-d-learn
On Monday, 2 September 2019 at 12:43:31 UTC, berni wrote: I need to pass the delegate add_new_way somehow to opApply. Here I managed this, by adding this delegate to the remove-delegate and safe it away for further use. This works, because if remove is never called, add_new_way is not used eit