By making the operators on quantity templates:
ref Quantity opAssign(U)( Quantity!(U) u2 ) {
static assert( SameUnit!(U,Unit) );
this.value = u2.value;
return this;
}Same for addition, subtraction and equality. Multiplication and division will have to have a different return type. Seems right to me, am I missing something? On 30 March 2011 00:39, David Nadlinger <[email protected]> wrote: > On 3/30/11 12:20 AM, Cristi Cobzarenco wrote: > >> Well they don't _have_ to be the same type as long they're convertible >> to one another, and one can make sure they're convertible based on the >> result of the double-inclusion. >> > > But how would you make them _implicitly_ convertible then? > > David > -- (Cristi Cobzarenco) Pofile: http://www.google.com/profiles/cristi.cobzarenco
