Boost logo

Boost :

From: Anatoli Tubman (anatoli_at_[hidden])
Date: 2001-09-01 07:31:49


On Friday 31 August 2001 23:51, Deane Young wrote:
> I want a small library that does not associate units with specific
> physical or geometric concepts (like distance, mass, time).
> In particular, I do not want the library to assume that different
> units measuring the same "quantity" are necessarily convertible
> into each other. I do want explicit casts required to convert one
> unit into another.

I once had a prototype quantity library that allowed for arbitrary
quantities or "dimensions". I think it is very useful, in part
for the reasons you outline. With such a library, you can
define your own "dimension" called Days, and another called Months.
They would not mix without a cast.

It is also possible to define, say, "kilograms-of-chocolate"
and "kilograms-of-concrete" dimensions which would behave
just like kilograms but not mix without a cast (and leave their
"chocolate" or "concrete" marks on any derived quantities,
like "kilograms-of-chocolate/second" and "kilograms-of-concrete/second"
which still don't mix).

I hope that Boos quantity library will eventually do that.

-- 
anatoli at ptc dot com -- opinions are mine

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk