Boost logo

Boost Users :

Subject: [Boost-users] [units] quantity to/from string / setting value component apart from the units
From: Michael Powell (mwpowellnm_at_[hidden])
Date: 2011-07-31 10:51:21


Units developers/user,

Preferably, I would like to get after a quantity's value and/or its units in
string format, plumb that through to the .NET Managed environment. The
managed plumbing is straightforward enough to research, no problem.

Can I use boost::units::to_string(q), where q is declared something like
quantity<si::length,float>? And then, what can we expect after calling it?
For instance, if q is set to 2.5 * meters, then can we expect "2.5 m"?

Also, can I set a quantity value apart from its unit? In other words, if
I've got a quantity<si::length,float> q again, I'd like to do something like
this:

q.value(2.5);

or:

q = 2.5;

Or some way that preserves the current quantity units.

Thank you...

Regards,

Michael



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