Q1
=============================================================================
What are the rules about what is allowed where? Or perhaps more
appropriately, why are the rules so strange? I've been playing with units in
boost 1.43.0 using gcc 4.4.3/mingw on win xp and I think I've deduced what
is allowed.
For instance, when declaring variables, you can do:
quantitysi::length l(1.0*si::meters) ;
quantitysi::meter_base_unit::unit_type l(1.0*si::meters) ;
quantityus::yard_base_unit::unit_type l(1.0*si::meters) ;
but not
quantitysi::length l(si::meters) ; (missing the scalar in front of the
units) or
quantitysi::meters l(1.0*si::meters) ; (si::meters is not
quantity-variable-declaration material??!?)
Q2
=============================================================================
I spent a long time looking for a way to construct a variable with
on-the-fly defined units, in order to store interim quantities which may
have strange units when implementing the computation of a long expression.
This would also be useful to precompute some terms which occur more than
once, but which don't necessarily represent any kind of sensible value that
you would return as a final result. I wanted to do something like this:
quantity