Call different member functions on object sequence with a generic handler function?

Timoses timosesu at gmail.com
Sun Jul 1 09:08:42 UTC 2018


On Sunday, 1 July 2018 at 06:55:35 UTC, Robert M. Münch wrote:
>
> The looping needs to be done in the handler because there are 
> two loops running one after the other and the range to loop 
> over is detected in the handler too. Otherwise a lot of code 
> duplication would happen.

Maybe an application for filter?

C[] cs = ...;
cs.filter!((c) => <predicate to be fulfilled>)
   .each!((c) => c.a())


More information about the Digitalmars-d-learn mailing list