import checkedint.throws : SmartInt; // use IntFlagPolicy.throws
assert(is(typeof(bits(5)) == int));
SmartInt!(int, No.bitOps) noBits = 5;
assert(is(typeof(bits(noBits)) == SmartInt!(int, Yes.bitOps)));
static assert(!__traits(compiles, noBits << 2));
assert((bits(noBits) << 2) == 20);
Get a view or copy of num that supports bitwise operations.
Useful in generic code that handles both basic types and checkedint types.