|
Boost : |
From: Phil Richards (news_at_[hidden])
Date: 2005-10-21 05:12:20
On 2005-10-20, Matthias Troyer <troyer_at_[hidden]> wrote:
[...]
> A general purpose system, that could be used to implement SI or
> totally alien unit systems --- even more alien than the US one :-)
> --- would be the best way to go. An SI unit system could then be
> easily built on top of it.
Well, SI wasn't a fundamental part of what I did - SI was an
instantiation of a set of dimensions and units like so:
struct SI : physical7_system<u::meter, ...> {};
You can define any system you like, and instantiate with any
set of units you like. The point is, however, that SI
(being derived from physical7_system<>) is only unit convertible
to other instantiations of physical7_system.
For example, it can convert to things from
struct Imperial : physical7_system<u::foot, ...> {};
but not
struct USDollar : currency_system<u::dollar>
or
struct UKPound : currency_system<u::sterling>
(which USDollar and UKPound are inter-convertible)
I'm obviously missing something. I can't see what more flexibility
is needed :-(
phil
-- change name before "@" to "phil" for email
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk