Boost logo

Boost Users :

Subject: [Boost-users] [units]
From: geocentrix (andrew.bond_at_[hidden])
Date: 2013-01-09 16:32:20


I am attempting to replace my own Quantity class with boost::units.

One thing that is easy in my existing code is to convert a quantity from any
unit of pressure into a specific unit, e.g. GPa (gigapascals), using a
function ConvertedTo(). For example:

Pressure converted_value = existing_value.ConvertedTo(GPa);

How do you do this with boost:units.?

I have the following things defined:

typedef boost::units::quantity<boost::units::si::pressure> Pressure;
static const Pressure Pa = 1.0 * boost::units::si::pascals;
static const Pressure GPa = 1e9 * Pa;

Pressure value(1.0^9 * Pa);

How do I display value in GPa? I am missing something very simple and
wondered if someone could advise, please?

Thanks in advance.
Andrew

--
View this message in context: http://boost.2283326.n4.nabble.com/units-tp4641179.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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