http://d.puremagic.com/issues/show_bug.cgi?id=6207
--- Comment #1 from Kenji Hara <k.hara...@gmail.com> 2011-10-16 18:58:34 PDT --- We can improve the string lambda features in std.algorithm! mixin template map(string pred) { enum map = `map!((a){ return `~pred~`; })`; } template map(alias pred) { auto map(E)(E[] r) { E[] result; foreach (e; r) result ~= pred(e); return result; } } void main() { int b = 10; auto r = map!q{ a * b }([1,2,3]); // --> mixin(`map!((a){ return ` ~ q{ a * b } ~ `; })`)([1,2,3]) // --> map!((a){ return a * b ; })([1,2,3]); assert(r == [10,20,30]); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------