SafeInt.opCast

this != 0

  1. M opCast()
  2. M opCast()
    struct SafeInt(N, IntFlagPolicy _policy, Flag!"bitOps" bitOps = Yes.bitOps)
    const pure nothrow @nogc
    M
    opCast
    (
    M
    )
    ()
    if (
    is(M == bool)
    )
    if (
    isIntegral!N &&
    )
  3. M opCast()

Examples

import checkedint.throws : SafeInt; // use IntFlagPolicy.throws

SafeInt!int n = -315;
assert( cast(bool)n);

n = 0;
assert(!cast(bool)n);

Meta