Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

core.internal.dassert

string _d_assert_fail(A)(scope const string op, auto ref scope const A a);
Generates rich assert error messages for unary expressions
The unary expression assert(!una) will be turned into assert(!una, _d_assert_fail("!", una)). This routine simply acts as if the user wrote assert(una == false).
Parameters:
string op Operator that was used in the expression, currently only "!" is supported.
A a Result of the expression that was used in assert before its implicit conversion to bool.
Returns:
A string such as "a != true" or "a == true".
template _d_assert_fail(A...)
Generates rich assert error messages for binary expressions
The binary expression assert(x == y) will be turned into assert(x == y, _d_assert_fail!(typeof(x))("==", x, y)).
Parameters:
string comp Comparison operator that was used in the expression.
A a Left hand side operand (can be a tuple).
B b Right hand side operand (can be a tuple).
Returns:
A string such as "$a $comp $b".