DebugInt

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

While this may be very helpful for debuggin your 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 if you get your algorithm wrong, or fail to add manual bounds checks in the right places.

If performance is your 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.

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

Members

Aliases

DebugInt
alias DebugInt = SafeInt!(N, policy, bitOps)
Undocumented in source.
DebugInt
alias DebugInt = Unqual!(BasicScalar!N)
Undocumented in source.

Meta