|
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