On Mon, 20 Apr 2009 18:12:16 +0900, Walter Bright <[email protected]> wrote:

bearophile wrote:
BCS Wrote:
Cool template function literals sounds interesting
 May I have one example of them?
I am looking in the docs, but I am not finding anything...

void foo(alias f)()
{
     f(3, 4);
}

foo!((x,y){return x * y;))();

void foo(alias f)()
{
    writefln(f(3, 4));
}
foo!((x,y){ return x * y; })();

This code doesn't work(compile error). But, following code works.

void bar(alias f)()
{
    writefln(f("bar"));
}
bar!((str) { return str; })();

Is this a bug?

--
tama <[email protected]>
http://profile.livedoor.com/repeatedly/
メンバー募集中
http://tpf.techtalk.jp/

Reply via email to