|
Boost Users : |
Subject: [Boost-users] [units] how to use scaled_base_unit?
From: Olaf Peter (ope-devel_at_[hidden])
Date: 2013-04-23 14:55:17
Hi,
at this time I start to understand boost.units. Following the doc
http://www.boost.org/doc/libs/1_53_0/doc/html/boost_units/Units.html#boost_unit
scaled_units are useful. But I didn't found use cases in the test or
examples. E.g.
https://svn.boost.org/svn/boost/trunk/libs/units/test/test_output.cpp
show how to typedef this, but no usage.
I try to map metric/si and imperial/us length to an intrinsic length
using integer scale factors to avoid double representation uncertainly.
Using BOOST_UNITS_DEFINE_CONVERSION_FACTOR I can convert meter and inch
to the intrinsic length. But what about mm/um and thou/mil etc? For this
I did consider scaled_base_unit. I like to convert between all of them.
Since the dimensions are constant, no runtime conversation are required
(as the dollar/euro example it shows). Later area calculations based on
the intrinsic length are required, convertible also to metric/si and
imperial systems.
Thanks,
Olaf
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net