Quantity.opCast

Cast a dimensionless quantity to a numeric type

  1. Q opCast()
  2. T opCast()
    struct Quantity(N, Dim...)
    const
    T
    opCast
    (
    T
    )
    ()

Examples

auto proportion = 12 * gram / (4.5 * kilogram);
static assert(is(typeof(proportion) == Dimensionless));
auto prop = cast(real) proportion;

static assert(!__traits(compiles, cast(real) meter));

Meta