Re: [boost] Boost Units library preview

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Matthias Troyer Sent: Sunday, August 20, 2006 6:29 AM To: boost@lists.boost.org Subject: Re: [boost] Boost Units library preview
...
Wait, if I multiply quantities (which have units) then also the result will have a unit. E.g. if I divide 10 meters by 2 seconds then I get 5 m/s . I wouldn't call that anonymous since I know the unit: m/s
This brings up a good question. Say you have two objects: meters m = 1; feet f = 2; What is the type (or unit) of the following expression? m * f; Is it feet? meters? Some other type? If there is a rule (in dimensional analysis), please let me know. Meantime, I define the resulting type as not as a unit at all but as the dimension of the unit: void f (length l) { ... } f (m * f); This is not to say that the user can not specify the desired units: rods r = m * f; This is possible since a quantity of a compatible dimension can be implicitly converted back into a measure of the appropriate unit (in theory at least). Eric.
participants (1)
-
Eric Lemings