safeInt

Get the value of num as a SafeInt!N. The integral type N can be infered from the argument.

@safe
SafeInt!(N, policy, bitOps)
safeInt
(
Flag!"bitOps" bitOps = Yes.bitOps
N
)
(
N num
)
if (
isIntegral!N ||
)

Examples

import checkedint.throws : safeInt, SafeInt; // use IntFlagPolicy.throws

auto a = safeInt(55uL);
static assert(is(typeof(a) == SafeInt!ulong));
assert(a == 55u);

Meta