Boost logo

Boost Users :

Subject: Re: [Boost-users] [Units] How to use units from different systems
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-12-23 16:19:27


AMDG

Juan José Icaza wrote:
> I am trying to use the boost::units library for the first time. I'm
> able to use the SI system. However, I would like to use units from
> different systems. Particularly, I would like to be able to write:
>
> quantity<si::length> L = 3.0 * us::inch + 0.50 * si::meter;
>
> The library comes with a us::inch_base_unit. But I don't know how to
> create a us::inch unit. Any help is appreciated.

us::inch_base_unit::unit_type inch;

quantity<si::length> L = static_cast<quantity<si::length> >(3.0 * inch)
+ 0.50 * si::meter;

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