23 Sep
2015
23 Sep
'15
5:50 a.m.
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).