13 Feb
2009
13 Feb
'09
4:39 p.m.
AMDG Esben Mose Hansen wrote:
What sort of magic do I have to write to get this sort of thing to work?
=== typedef boost::units::quantityboost::units::si::length length_t;
length_t earth_radius = 3438.461 * nautical_mile; ===
boost::units defines a boost::units::metric::nautical_mile_base_unit in terms of meters, so the numbers and concepts are in the library already. Somehow.
Thanks for any help :)
A base_unit provides a nested ::unit_type typedef. typedef boost::units::metric::nautical_mile_base_unit::unit_type nautical_mile; length_t earth_radius(3438.461 * nautical_mile()); Note that converting between different units is explicit so you can't use the copy construction syntax. In Christ, Steven Watanabe