SmartInt.opCast

this != 0

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

Examples

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

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

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

Meta