Boost Users :
Subject: Re: [Boost-users] [units] How to multiply a quantity with a dimensionless factor
From: Nathan Crookston (nathan.crookston_at_[hidden])
Date: 2011-08-01 11:58:35
On Mon, Aug 1, 2011 at 7:39 AM, Marcel <minusdreidb+boost_at_[hidden]> wrote:
> thanks for your reply. The example compiles here too in fact, which made
> me check my actual code more thoroughly: I had used "2" for the factor
> in my actual code instead of "2.0" as stated in my example. The
> differing value types seemed to cause the problem.
Ah, yes. The scalar multiplication is defined for the underlying type
of the quantity -- had you written quantity<si::length, float> (rather
than use the implicit double) you would have had to use 2.f * a; i.e.
implicit conversions of scalar types aren't supported. That's bitten
me a few times.
Glad it's working.
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