DebugInt

template alias that evaluates to SafeInt!(N, policy, bitOps) in debug mode, and N in release mode. This way, SafeInt!N is used to debug integer logic while testing, but the basic N is used in release mode for maximum speed and the smallest binaries.

While this may be very helpful for debugging algorithms, note that DebugInt is not a substitute for input validation in release mode. Unrecoverable FPEs or silent data-corrupting overflow can still occur in release mode in algorithms that are faulty, or missing the appropriate manual bounds checks.

If performance is the only motivation for using DebugInt rather than SmartInt, consider limiting DebugInt to only the hotest code paths - inner loops and the like. For most programs, this should provide nearly the same performance boost as using it everywhere, with far less loss of safety.

template DebugInt (
N
Flag!"bitOps" bitOps = Yes.bitOps
) if (
isIntegral!N ||
isCheckedInt!N
) {}

Meta