enforceImpl

Enforces that given expression evaluates to boolean true after implicit conversion.

NB! When present 'msg' is used instead of existing 'e.message()'

In D2 we will be able to call this via UFCS: exception.enforce(1 == 1);

  1. void enforceImpl(T ok, istring msg, istring file, int line)
  2. void enforceImpl(Exception e, T ok, istring msg, istring file, int line)
    void
    enforceImpl
    (
    T
    )
    (
    lazy Exception e
    ,
    T ok
    ,
    lazy istring msg
    ,
    istring file
    ,
    int line
    )
  3. void enforceImpl(T1 a, T2 b, istring file, int line)
  4. void enforceImpl(Exception e, T1 a, T2 b, istring file, int line)

Parameters

T

type of expression to test

e Exception

exception instance to throw in case of an error (evaluated once in case of an error, not evaluated otherwise)

ok T

result of expression

msg istring

optional custom message for exception

file istring

file of origin

line int

line of origin

Throws

e if expression evaluates to false

Meta