SmartInt.opCast

this != 0

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

Examples

1 import checkedint.throws : SmartInt; // use IntFlagPolicy.throws
2 
3 SmartInt!int n = -315;
4 assert( cast(bool)n);
5 
6 n = 0;
7 assert(!cast(bool)n);

Meta