|
Boost : |
From: Deane Yang (deane_yang_at_[hidden])
Date: 2004-01-11 16:04:40
Phil Richards wrote:
> On Sun, 11 Jan 2004 13:56:16 -0500, Deane Yang wrote:
>
> My reply is those who have posted saying "You don't need to all this
> complicated dimensional analysis stuff - just build a units library then
> add dimensional analysis on top". I don't believe it can be done that way
> round - which I think is what you are saying too. I believe (and have
> kept saying) that a units library must incorporate dimensional analysis in
> order to be useful. Others didn't appear (to me) to have that view.
> Maybe I was confused.
To be honest, I think you were. As far as I can tell, everyone has
always assumed that the units library would handle the natural
derivation of units arising from arithmetic operations.
In particular, the units library should contain
template <class unit1, class unit2>
product<unit1, unit2>::type
operator*(unit1 quantity1, unit2 quantity2);
template <class unit1, class unit2>
quotient<unit1, unit2>::type
operator/(unit1 quantity1, unit2 quantity2);
template <class unit1, class rational>
power<unit, rational>::type
pow(unit base, rational exponent);
I think everyone agrees with this. The question is whether the
types "unit1", "unit2", and "unit" should be replaced by
"dimension1", "dimension2", and "dimension".
(By now, I think they should be dimensions with respect to explicitly
stated units, which is, in fact, what I think some of the proposals
actually do. You want to allow the same dimension but with different
units, AND you want to allow different dimensions that use the same
units. A given type should specify BOTH the dimension and the unit.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk