Boost logo

Boost Users :

Subject: Re: [Boost-users] problem with boost units
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-09-23 01:50:56


On 17/09/2015 21:17, Michael wrote:
> It's because you are trying to assign a quantity to a dimension.
>
> quantity<volume> my_vol = 9f * cubic_meters;
>
> Or if your compiler has auto support.
>
> auto my_vol = 9f * cubic_meters;
>
> See the examples for clarification as well.

Note that (at least in my limited experience) it's best to avoid using
"auto" with Boost.Units, as this does not properly collapse scaled units
and you can get even weirder errors.

Stick to using quantity<T> explicitly (or a convenience typedef for it).


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