enforceEx

An overload of enforceEx which allows constructing the exception with the arguments its ctor supports. The ctor's last parameters must be a string (file) and size_t (line).

template enforceEx(E)
T
enforceEx
(
T
string file = __FILE__
size_t line = __LINE__
Args...
)
(,
Args args
)
if (
is(typeof(new E(args, file, line)))
)

Members

Functions

enforceEx
T enforceEx(T value, Args args)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

static class Exc : Exception
{
    this(int x, string file, int line)
    {
        super("", file, line);
        this.x = x;
    }

    int x;
}

try
{
    enforceEx!Exc(false, 1);
    assert(0);
}
catch (Exc ex)
{
    assert(ex.x == 1);
}

Meta