
Boost : 
From: David Richardson (dgr24_at_[hidden])
Date: 20031015 10:27:39
Were cases other then addition considered? It seems like this
would not work for multiplication unless the user was also allowed
to specify a rule of the resulting unit of a multiplication of a
user tagged variable.
In your example, what are the units of squaring a gallon tagged
with temperature?
How often do problems like this come up? Is it better to just let
people with such problems make their own class that uses the unit
library for the gallon part and implements the additional logic in
the new class?
Dave
Beman Dawes wrote:
> In prior discussions of unitsofmeasure problems, it was pointed out
> that in many applications it might be necessary to tag types with more
> than just simple unitsofmeasure like gallons or liters.
>
> For example, if x and y are variables representing gallons, it still may
> not be valid to add them together. (Consider that x may be gallons of
> unleaded regular gasoline, while y may be gallons of propane.)
>
> Even if x and y both represent gallons of propane, there can still be
> problems: to do addition correctly, you must either know that the
> gallons are temperature compensated or know the temperature of each.
> (Propane's coefficient of expansion is high enough that by US law
> commercial measurements must be temperature compensated.)
>
> IIRC, prior discussions leaned toward solving such problems by allowing
> for user supplied unitsofmeasure. That would allow industry specific
> problems like the above examples to be solved without requiring the
> library to know about every unitofmeasure need in the world.
>
> Beman
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk