Boost logo

Boost :

From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2007-01-20 10:32:07

Matthias Schabel wrote:
>> I'm not one of the people who initially requested this, but I can
>> absolutely see a use for dimensional analysis when it comes to
>> finances. Think of $/flop, watt/flop or even $-watt/flop for
>> procuring computing systems.
> Good point. Anyway, the library was designed to make implementing
> new unit systems relatively easy (as library implementation goes), so
> this kind of usage should be simple. For things like $/watt, you can
> even
> just extend the existing SI system...

(butting in)

I'm not sure about that. You had two ideas, the first was to forward
everything to the value_type, so you'll have a us_dollar value_type,
etc. I thing it's not convenient. Most users will find something like

quantity<currency/*, default to double*/> q1(1500.0 * us_dollar);

makes more sense than

quantity<currency, us_dollar> q1(1500.0);

It certainly fits the rest of the library better, IMO. More than that,
the second idea of extending the SI system pretty much, AFAIU, forces
the value_type to *not* be anything like us_dollar - it should fit
length and mass to!

So I believe it boils down to providing a runtime-changeable conversion
ratios for some units (currency), in addition to the currently fixed
ratios for other units (physics). Whether or not you want to support it,
is a completely different matter...


Boost list run by bdawes at, gregod at, cpdaniel at, john at