std.contracts.enforceEx

Steve Teale steve.teale at britseyeview.com
Mon Feb 8 00:17:21 PST 2010


Perhaps a bug? If this is written as a normal function template it seems 
to work the same way, but has the advantage of generating better Ddoc 
information. That is:

T enforceEx(E, T)(T value, lazy string msg = "")
{
    if (!value) throw new E(msg);
        return value;
}

instead of:

template enforceEx(E)
{
    T enforceEx(T)(T value, lazy string msg = "")
    {
        if (!value) throw new E(msg);
        return value;
    }
}



More information about the Digitalmars-d mailing list