From: Leland Brown (lelandbrown_at_[hidden])
Date: 2006-06-09 04:57:58
Andy Little <andy <at> servocomm.freeserve.co.uk> writes:
> Consider the calculation 1 km * 1 millisecond.
> The external units approach
> 1 * km * 1 * millisecond,
> which expanding the constants would be
> 1 * 1000. * 1 * .001
> In pqs the internal calculation at runtime is simply
> 1. * 1.
> The type of the result encodes the calculation 1000 * .001 as
> plus<3,-3>::value in the unit of the result.
BTW, I think this is an excellent example. It shows clearly how keeping track
of the units at compile time would benefit the user, and also gives an idea
of how it works.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk