SafeInt.bits

Get a view of this SafeInt that allows bitwise operations.

struct SafeInt(N, IntFlagPolicy _policy, Flag!"bitOps" bitOps = Yes.bitOps)
@property ref
inout(SafeInt!(N, policy, Yes.bitOps))
bits
return inout pure @safe nothrow @nogc
(
)
if (
isIntegral!N &&
isUnqual!N
)

Examples

1 import checkedint.throws : SafeInt; // use IntFlagPolicy.throws
2 
3 SafeInt!(int, No.bitOps) n = 1;
4 static assert(!__traits(compiles, n << 2));
5 assert(n.bits << 2 == 4);

Meta