
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Ben Strasser Sent: Friday, September 01, 2006 9:15 AM To: boost@lists.boost.org Subject: Re: [boost] Boost Units library preview
I'm having a serious problem with facets and if I don't find a solution for it facets are definately out of the game.
Several unit types can describe the same unit. For example unit<quantity<length, 1, mass, 1> > is the same as unit<quantity<mass, 1, length, 1> > but when it comes to types they are different.
Why do you use the word 'unit' in these examples? I don't see any units in there. A unit is a standard of measure. A meter is a unit. Mass and length are dimensions.
The unit code can cope with this. facets on the other hand requier an exact type to be able to use unit specific facets.
I only see 3 possible solutions:
1) Add a facet for each permutation of the base quantities (= length & time_ here). This is only acceptable for small quantities because the number of combinations grows too fast. Also I don't like the idea of spamming the locale objects full.
2) Make the quantity lists sortable and only look up the sorted versions in the locale objects. The problem is that for this I need some smaller-as meta function to define the order. Unfortuately I have no idea on how to generate a default one (typeid unfortuately only return runtime objects).
If you look at the proposed Boost Units library, the base dimensions are implemented in such a way (with a rank) that allows them to be normalized (e.g. sorted). Eric.