std.log version 2

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Jun 4 10:28:45 PDT 2011


Isn't this a little better:

void main()
{
    foreach(i; 0 .. 10)
    {
        writeln(i);
        when(i == 9, log("wee"));
    }
}


bool log(string str)
{
    writeln(str);
    return true;
}

void when(bool delegate()[] dg...)
{
    if (dg[0]())
        dg[1]();
}


More information about the Digitalmars-d mailing list