SmartInt.this

Assign the value of that to this SmartInt instance.

checkedint.to() is used to verify that >= N.min && that <= N.max. If not, an IntFlag will be raised.

  1. this(const M that)
    struct SmartInt(N, IntFlagPolicy _policy, Flag!"bitOps" bitOps = Yes.bitOps)
    this
    @safe
    (
    M
    )
    (
    const M that
    )
    if (
    isCheckedInt!M ||
    isScalarType!M
    )
    if (
    isIntegral!N &&
    isUnqual!N
    )
  2. typeof(this) opAssign(const M that)

Examples

1 import checkedint.sticky : SmartInt; // use IntFlagPolicy.sticky
2 
3 // Any basic scalar or checkedint *type* is accepted...
4 SmartInt!int n = 0;
5 n = cast(ulong)0;
6 n = cast(dchar)0;
7 n = cast(byte)0;
8 n = cast(real)0;
9 assert(!IntFlags.local);
10 
11 // ...but not any *value*.
12 n = uint.max;
13 n = long.min;
14 n = real.nan;
15 assert(IntFlags.local.clear() == (IntFlag.posOver | IntFlag.negOver | IntFlag.undef));

Meta