bscal

Get a view or copy of num as a basic scalar.

Useful in generic code that handles both basic types, and checkedint types.

  1. inout(N) bscal [@property getter]
    @property ref
    inout(N)
    bscal
    @safe
    (
    N
    )
    (
    return ref inout(N) num
    )
    if (
    isScalarType!N
    )
  2. inout(N) bscal [@property getter]
  3. N bscal [@property getter]
  4. BasicScalar!N bscal [@property getter]

Examples

1 import checkedint.throws : smartInt, SmartInt; // use IntFlagPolicy.throws
2 
3 assert(is(typeof(bscal(2u)) == uint));
4 assert(is(typeof(bscal(SmartInt!int(2))) == int));
5 
6 assert(bscal(-3153) == -3153);
7 assert(bscal(smartInt(75_000)) == 75_000);

Meta