|
Boost Users : |
Subject: [Boost-users] [units] How to assign "ft" to an si::length?
From: Terry Golubiewski (tjgolubi_at_[hidden])
Date: 2010-05-19 13:49:34
I am having trouble seeing how to use mixed units.
The program below compiles and runs.
See the changes I "wish" I could make as comments.
terry
#include <boost/units/systems/si.hpp>
#include <boost/units/base_units/us/foot.hpp>
#include <boost/units/quantity.hpp>
#include <boost/units/io.hpp>
#include <iostream>
#include <iomanip>
using namespace std;
using namespace boost;
using namespace boost::units;
int main() {
static const si::length m = si::meter;
// static const si::length ft = ???;
typedef quantity<si::length> Length;
Length x = 2.0 * m;
Length y = 3.0 * m; // instead of "m" use "ft";
cout << "x=" << x << " y=" << y << endl;
Length z = x + y;
cout << "x+y=" << z << endl; // display result in "ft"
return 0;
} // main
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