adding delegate to opApply

berni someone at somewhere.com
Tue Sep 3 15:38:55 UTC 2019


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) => myDelegate(t))

Thanks for your answer. It's not exactly, what I was looking for, 
but meanwhile I think, the whole idea was not reasonable. I 
meanwhile returned to using a normal function call instead of 
opApply, which makes it easy to pass a delegate as one of the 
parameters.


More information about the Digitalmars-d-learn mailing list