[GSoC Proposal] Statically Checked Measurement Units
Cristi Cobzarenco
cristi.cobzarenco at gmail.com
Wed Mar 30 02:21:03 PDT 2011
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 <see at klickverbot.at> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110330/f775b2dc/attachment.html>
More information about the Digitalmars-d
mailing list