Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::units - converting from one derived_dimension to another across systems (imperial to metric)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-11-15 15:18:44


AMDG

On 11/14/2018 05:04 AM, Matt Vinson via Boost-users wrote:
> I am having trouble converting from one derived_dimension to another across systems (imperial to metric).  I'd like to convert, say, lb/in to, say, kg/m.  I thought I would do the following but get a compiler error #:

It's not going to work. lb is a unit of
force, but kg is a unit of mass. They are not
compatible and there is no conversion between
them.

> *.h--------------------------------------------------------------------------------
> namespace dimensional_analysis {
>     namespace lineal_force {        //lb/in
>         typedef boost::units::derived_dimension<
>             boost::units::us::pound_force_base_unit, 1,
>             boost::units::us::inch_base_unit, -1
>         >::type lb_per_inch_dimension;

units are not dimensions. You can't use
derived_dimension with base_units.

>  <snip>
>

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