<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>I am trying to use Boost.Units to convert between different units.</div><div><br></div><div>I have implemented the example code for the "Radar Beam Height" [1] section but trying to convert between nautical mile and imperial foot result in a compiler error:</div><div><br></div><div>I have:</div><div>typedef boost::units::quantity<boost::units::si::length> Meters;<br></div><div><div>typedef boost::units::quantity<imperial::length> Feet;</div><div>typedef boost::units::quantity<nautical::length> NMiles;</div></div><div><div>double func()</div><div>{</div><div> // Working</div><div> const Meters si1(300.0*nautical::miles);</div><div> const Meters si2(300.0*imperial::feet);</div><div> const Feet feet1(300.0*imperial::feet);</div><div> const Feet feet2(300.0*boost::units::si::meters);</div><div> const NMiles mile1(300.0*nautical::miles);</div><div> const NMiles mile2(300.0*boost::units::si::meters);</div><div><br></div><div> // BROKEN</div><div> const Feet feet3(300.0*nautical::miles);</div><div> const NMiles mile3(300.0*imperial::feet);</div></div><div>}</div><div><br></div><div>The first few works, converting between meters and the new units, but converting between the two does not work. </div><div><br></div><div>To see the issue see the code on Compiler Explorer here:</div><div><a href="https://gcc.godbolt.org/z/MpvuMy">https://gcc.godbolt.org/z/MpvuMy</a></div><div><br></div><div>How can I get this working?</div><div><br></div><div>[1] <a href="https://www.boost.org/doc/libs/1_68_0/doc/html/boost_units/Examples.html#boost_units.Examples.RadarBeamHeightExample">https://www.boost.org/doc/libs/1_68_0/doc/html/boost_units/Examples.html#boost_units.Examples.RadarBeamHeightExample</a></div><div><br></div><div>Regards,</div></div></div></div></div></div></div></div></div>