
AMDG On 08/30/2011 01:04 AM, Thomas Taylor wrote:
Could you please review the following patch for inclusion in boost::units?
*WHY*: Obviously this only defines a conversion for boost::units::one to a numerical 1. When trying to convert at runtime (aiming for a runtime/dynamic unit instead of the compiletime/static unit provided) I use the following function:
template
double unit_dispatch2t(U1 const& u1, U2 const& u2) { return bu::conversion_factor(u1,u2); } where U1 and U2 are boost::unit::unit derivatives.
Without a conversion operator the compiler chickens out by claiming to not be able to convert boost::units::one to (in my case) double.
<snip>
I assume that the case that fails is something like double x = conversion_factor(si::meters, si::meters); ? Fixed in r74159. In Christ, Steven Watanabe