|
Boost : |
From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2003-04-27 15:03:43
"Terje Slettebø" <tslettebo_at_[hidden]> wrote in message
news:030f01c30cde$9c9c0710$8d6c6f50_at_pc...
>From: "Pavel Vozenilek" <pavel_vozenilek_at_[hidden]>
>> Currency conversion as drop-in library is IMHO not possible - currencies
>> differ from strict units like weight and future applications may require
>> functionality beyond current requirements.
> Well, your library is very general, where you provide conversion functions
> between any two types. If you define each currency as a type, wouldn't
this
> cover the functionality for converting between currencies? If not, what
> could be needed?
OK, I mean it would be very hard to create library which already provides
conversion routines. quantity.hpp is only kit to use the user provided
conversion routines easier.
> 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 currencies,
> 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.
/Pavel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk