SmartInt.bits

Get a view of this SmartInt that allows bitwise operations.

  1. inout(SmartInt!(N, policy, Yes.bitOps)) bits [@property getter]
    struct SmartInt(N, IntFlagPolicy _policy, Flag!"bitOps" bitOps = Yes.bitOps)
    @property ref return inout pure @safe nothrow @nogc
    static if(bitOps)
    inout(SmartInt!(N, policy, Yes.bitOps))
    bits
    ()
    if (
    isIntegral!N &&
    )
  2. SmartInt!(N, policy, Yes.bitOps) bits;

Examples

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

SmartInt!(int, No.bitOps) n = 1;
static assert(!__traits(compiles, n << 2));
assert(n.bits << 2 == 4);

Meta