|
Boost Users : |
Subject: Re: [Boost-users] [units]
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-08-30 11:09:39
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 <typename U1, typename U2>
> 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
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