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. N bscal [@property getter]
  2. BasicScalar!N bscal [@property getter]
    @safe @property
    bscal
    (
    N
    )
    (
    const N num
    )

Examples

import checkedint.throws : smartInt, SmartInt; // use IntFlagPolicy.throws

assert(is(typeof(bscal(2u)) == uint));
assert(is(typeof(bscal(SmartInt!int(2))) == int));

assert(bscal(-3153) == -3153);
assert(bscal(smartInt(75_000)) == 75_000);

Meta