Confusion with anonymous functions and method overloads
Anonymouse via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 21 07:54:30 PDT 2016
On Saturday, 21 May 2016 at 14:39:59 UTC, pineapple wrote:
> void clean(in void delegate(in T value) func){
> this.clean((in T values[]) => {
> foreach(value; values) func(value);
> });
This doesn't do what you think it does. It passes a lambda that
*returns* that foreach function (that returns void).
> void clean(in void delegate(in T value) func){
> this.clean((in T values[]){
> foreach(value; values) func(value);
> });
> }
This passes a lambda (that returns void).
See https://dpaste.dzfl.pl/f93b9c0c8426
More information about the Digitalmars-d-learn
mailing list