Boost logo

Boost :

From: David Greene (greened_at_[hidden])
Date: 2006-06-07 17:10:33


Andy Little wrote:

>>I don't see why kg as the "SI unit for mass" requires all this
>>prefix_offset stuff. You'd just use pqs::mass:kg, right?
>
>
> grammes and milligrammes are common units too. The output of socalled coherent
> quatities is automated so that its not necessary to customise each units ouput.
> The prefix_offset is necessary to stick the correct prefix on, usually for mass,
> but also for anything that starts with mass, like 'mass_flow'.

Here's my expectation. Tell me if I'm wrong:

pqs::mass:g grams(10);
pqs::mass:kg kilograms(10);

cout << grams << endl;
cout << kilograms << endl;
cout << kilograms + grams << endl;

I'd expect to see something like this:

10 g
10 kg
10.01 kg

How does this involve prefix_offset at all? What's the point of it?
How is mass different than, say, length in this regard?

If prefix_offset is not exposed to the user at all, then I submit
that it serves no useful function in the library and only makes
the implementation (and extensions) unnecessarily difficult.

                         -Dave


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