On Thursday, 13 April 2017 at 05:51:27 UTC, Dukc wrote:
auto use(alias F, T)(T t){return F(t);}void main() { import std.stdio; foreach(i; 1 .. 11) { foreach(j; 1 .. 11) write((i * j).use!(x => x*x), " "); writeln; } }This way, you can avoid writing long expressions twice with UFCS.
If fact you don't need any template to do this. Try the next:
foreach(i; 1 .. 11)
{ foreach(j; 1 .. 11) write((x => x*x)(i * j), " ");
writeln;
}
