Why does map take lambda as a template parameter
xtreak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Apr 23 13:06:39 PDT 2016
map takes lambda as a template parameter and so does filter and
many other functions. Sometimes they take something other than
lambda as a template parameter. Eg. In case of to!int("5") int is
a type and hence might need it as a template parameter but why
does map and others take it as template parameter.
Adam D Ruppe pointed out in IRC it helps in inlining and
optimization. Is there a thumb rule to decide this so that my
functions too can benefit the performance and hence I could
structure and understand my code better.
More information about the Digitalmars-d-learn
mailing list