Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-04-27 17:17:07

>From: "Pavel Vozenilek" <pavel_vozenilek_at_[hidden]>

> "Terje Slettebø" <tslettebo_at_[hidden]> wrote in message
> news:030f01c30cde$9c9c0710$8d6c6f50_at_pc...
> >From: "Pavel Vozenilek" <pavel_vozenilek_at_[hidden]>
> > I realise that in this case, it may be a lot of functions to define, to
> > define the conversion between any two currencies - for e.g. 20
> > that's around 400 functions to define.
> >
> Not for quantity.hpp. One unit (quantity) there is primary ('privileged')
> and conversions are possible between this and other units. Then it is
> possible to do secondary unit 1 -> primary unit -> secondary unit2
> conversion. This is model of many real systems.

Ah, yes. This was also the reason for my earlier posting, if currencies
could be converted via a "reference value". That would allow one to define
the conversion between N currencies, using just N or 2N (rather than N^2)
factors or conversions.

This could also be done to use units outside SI with SI, by defining
conversion from/to SI, or use SI internally for their representation. This
way, you could do feet * feet, where they either converted to meter before
the multiplication, or used meter as internal representation, and you'd get
an answer as m^2 (or feet^2, if you define a conversion to that).



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