Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] implicit type conversions to specific unit quantity
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-08-16 22:12:21

On 16/08/2015 05:18, Michael Powell wrote:
> Also, I'm not positive, the inches <-> meters length conversion isn't
> already defined? At least some errors leading up to this point seem to
> suggest that perhaps it is. Although I want to be careful that meters
> <-> inches is correct and that yards aren't getting in the way.

Inches are defined as a scaled version of yards, and a conversion
between yards and meters is defined, so it is redundant (and not
possible) to also define a conversion between meters and inches.

After omitting the conversion factor, you also need to correct your

typedef inch_base_unit::unit_type inch_unit;

quantity<inch_unit> to_inches_length_quantity(quantity<length> const & L)
     const quantity<inch_unit> result_(L);
     return result_;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at