Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Units Example: Convert between nautical mile and imperial foot
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-09-27 02:29:37


On 27/09/2018 13:56, Steven Watanabe wrote:
> The library has no way to know what the correct
> intermediate unit is.

Yes, that's what I said.

> You can use BOOST_UNITS_DEFAULT_CONVERSION to specify.
> (Yes, I know this is kind of clunky).

Interesting. I was not aware of that (and that's not how I initially
read the [minimal] docs for it, although now that you've said that I can
see how it can be interpreted that way).

Oddly, given these:

BOOST_UNITS_DEFAULT_CONVERSION(imperial::length_base_unit, si::length);
BOOST_UNITS_DEFAULT_CONVERSION(nautical::length_base_unit, si::length);

Only one of these two lines actually needs to be defined in order to
make both direct conversions (ft -> nmi and nmi -> ft) compile. Given
that all three base units are independent, how does this work?


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