The OpenD Programming Language

Checked.this

Constructor taking a value properly convertible to the underlying type. U may be either an integral that can be converted to T without a loss, or another Checked instance whose representation may be in turn converted to T without a loss.

  1. this(U rhs)
    struct Checked(T, Hook = Abort)
    this
    (
    U
    )
    (
    U rhs
    )
    if (
    valueConvertible!(U, T) ||
    !isIntegral!T &&
    is(typeof(T(rhs)))
    ||
    is(U == Checked!(V, W),
    V
    W
    ) &&
    is(typeof(Checked!(T, Hook)(rhs.get)))
    )
    if (
    is(T == Checked!(U, H),
    U
    H
    )
    )
  2. this(Range str)

Examples

auto a = checked(42L);
assert(a == 42);
auto b = Checked!long(4242); // convert 4242 to long
assert(b == 4242);

Meta