Quantity

A quantity checked at compile-time for dimensional consistency.

Constructors

this
this(Q qty)

Creates a new quantity from another one with the same dimensions.

this
this(T scalar)

Creates a new dimensionless quantity from a number

Alias This

get

Implicitly convert a dimensionless value to the value type.

Members

Aliases

valueType
alias valueType = N
Undocumented in source.

Functions

baseUnit
Quantity baseUnit()

Returns the base unit of this quantity.

get
N get()

Implicitly convert a dimensionless value to the value type.

isConsistentWith
bool isConsistentWith(Q qty)

Tests wheter this quantity has the same dimensions as another one.

opAssign
Quantity opAssign(Q qty)
Quantity opAssign(T scalar)
opBinary
Quantity opBinary(Q qty)
Quantity opBinary(T scalar)
auto opBinary(Q qty)
opBinaryRight
Quantity opBinaryRight(T scalar)
auto opBinaryRight(T scalar)

Operator overloading

opCast
T opCast()

Cast a dimensionless quantity to a numeric type.

opCmp
int opCmp(Q qty)
int opCmp(T scalar)
opEquals
bool opEquals(Q qty)
bool opEquals(T scalar)
opOpAssign
void opOpAssign(Q qty)
void opOpAssign(T scalar)
opUnary
Quantity opUnary()

Operator overloading

rawValue
N rawValue()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
void toString(void delegate(const(char)[]) sink, FormatSpec!char fmt)
Undocumented in source. Be warned that the author may not have intended to support it.
value
N value(Q target)

Gets the value of this quantity when expressed in the given target unit.

Manifest constants

dimensions
enum dimensions;

The dimensions of the quantity

Variables

isDimensionless
enum bool isDimensionless;

Test whether this quantity is dimensionless

Parameters

N

the numeric type of the quantity.

See Also

QVariant has the same public members and overloaded operators as Quantity.

Meta