|
Boost : |
From: Matthias Schabel (boost_at_[hidden])
Date: 2004-01-09 15:14:42
> For me this is the guts of the units library. Namely, it should
> automatically define derived units that arise when doing arithmetic
> operations involving quanitities given in units. If your physical
> quantity library is doing this for predefined physical units, I don't
> understand why
> it wouldn't be a smaller library if it simply did it for user-defined
> units and skipped the step of pre-defining the units.
>
> To answer your question "what is typeof(j / s)", you would do
> what Hugo Duncan described a long, long time ago. A unit type
> would consist of a typelist of fundamental unit tags (all user-defined,
> if I had it my way) and a rational number associated with each
> tag. Then the type of "j/s" would be a typelist
> containing a tag representing joules (with an exponent of 1) and
> another tag representing seconds (with an exponent of -1).
Deane,
May I suggest you take a look at my YANL library (on the Yahoo files
section)? Its dimensional
analysis code (which underlies the unit code that is the subject of so
much debate) does exactly
what you discuss above...
> -----------------------------------------------------------------------
> ----------------------------
Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
801-587-9413 (work)
801-585-3592 (fax)
801-706-5760 (cell)
801-484-0811 (home)
mschabel at ucair med utah edu
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk