|
Boost : |
From: Gerhard Wesp (gwesp_at_[hidden])
Date: 2006-06-07 04:58:07
> all numeric values input or output are enforced by the compiler to have
> documented units. Code is clear and simple, like this:
>
> length x = 1000.0 * meter;
> velocty v = 2.0 * nautical_mile / hour;
> ...
> time t = x / v; // typically LOTS of computations here
> ...
> cout << "Time in seconds = " << t / second;
I like this notation.
I'm not sure, however, why t = x / v should involve lots of computation.
If length, velocity, time are implemented as I proposed in my other
email, x would contain the length in meters, v the velocity in meters
per second, and time the time in seconds. Thus, one division. The
conversions into SI units would be done in the assignments above.
Regards
-Gerhard
-- Gerhard Wesp ZRH office voice: +41 (0)44 668 1878 ZRH office fax: +41 (0)44 200 1818 For the rest I claim that raw pointers must be abolished.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk