Mod

Module type within inclusive value range [0 .. m-1].

Similar to Ada's modulo type 0 mod m.

template Mod (
size_t m
T = UnsignedOfModulo!m
) if (
m >= 1 &&
isIntegral!T
) {}

Members

Aliases

UI
alias UI = UnsignedOfModulo!m
Undocumented in source.

Manifest constants

exactStorageTypeMatch
enum exactStorageTypeMatch;
Undocumented in source.

Structs

Mod
struct Mod
Undocumented in source.

See Also

https://forum.dlang.org/post/hmrpwyqfoxwtywbznbrr@forum.dlang.org http://codeforces.com/contest/628/submission/16212299

TODO: reuse ideas from bound.d

TODO: Add function limit() static if (isPowerOf2!m) { return x & 2^^m - 1; } else { return x % m; }

invariant { assert (0 <= x && x < m); }

called after opBinary opUnary etc similar to what is done http://codeforces.com/contest/628/submission/16212299

TODO: Move to Phobos std.typecons

Meta