Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Units Example: Convert between nautical mile and imperial foot
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-09-27 14:06:08


AMDG

On 09/26/2018 08:29 PM, Gavin Lambert via Boost-users wrote:
>
> 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?
>

If you have only the first, then
ft -> nmi is reduced to meters -> nmi which
can be handled directly. The library doesn't
care about the direction of the conversion.

In Christ,
Steven Watanabe


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