Questions tagged [boost-units]
67 questions
1
vote
0 answers
Assignment operators in a class deriving boost::units::quantity
I have a problem with the assignment operators. Please have a look at my code below:
template
class Parameter : public boost::units::quantity
{
public:
Parameter

Martin Kopecký
- 912
- 5
- 16
1
vote
1 answer
boost::lexical_cast with boost::units::quantity does not compile any more
I have a problem with code that parses values taken via boost_program_options to boost::units quantities. It used to work just fine, and now, on a new setup, no longer does. The obscure error message hints at a problem with boost::lexical_cast,…

fedro
- 13
- 3
1
vote
1 answer
Define minutes unit
Here's a bit of code from another question which adds 29.0 minutes to 60.0 seconds and displays the result in hours:
cout <<
static_cast>
(quantity

dharmatech
- 8,979
- 8
- 42
- 88
1
vote
1 answer
Formatting time with boost chrono
I wonder if is there any way to get only the time without printing out the units :
#include
#include
boost::chrono::milliseconds sumGlobal;
int main() {
boost::chrono::high_resolution_clock::time_point t1 ;
…

Alexander
- 43
- 1
- 9
1
vote
1 answer
Boost: typedef for rpm
I'm trying to use boost::units in my code to define a type RoundsPerMinute. However I am not really understanding how to do that.
I've defined a minute via
using boost::units::si::seconds;
typedef boost::units::make_scaled_unit <…

Frankie
- 653
- 1
- 9
- 20
1
vote
0 answers
Type boost::units::derived_dimension could not be resolved by Eclipse CDT
I have defined a new derived_dimension type, specific_entropy_dimension, and a unit, specific_entropy in the header below. This compiles just fine without warnings using g++, but, Eclipse CDT's indexer fails to resolve the type with the…

ccook
- 5,869
- 6
- 56
- 81
0
votes
1 answer
How to print prefixed unit without changing base unit?
If I define a value in bytes and print it:
using namespace boost::units;
using namespace boost::units::information;
quantity nbytes = 1234 * bytes;
std::cout << nbytes << std::endl; // 1234 B
Ok, that's fine, but what I really want is "1.234…

John Freeman
- 2,552
- 1
- 27
- 34
0
votes
1 answer
define a boost::units angle in degrees
How do I define a boost units angle in degrees? The below shows radian which works and degrees which does not.
#include
#include
#include
// This works…

J'e
- 3,014
- 4
- 31
- 55
0
votes
0 answers
Seamless mix and match boost::units::quantity
Both, std::chrono::duration and boost::units::quantity
0
votes
1 answer
Boost::units with non SI units
This is driving me nuts. I'm trying to do something simple: Convert between si::meter and US foot.
I can do do:
quantity l = 1 * si::meters;
but there doesn't seem to be a US based system, e.g. I cannot find
quantity l = 1 *…
0
votes
0 answers
neither electric field strength, nor intensity in boost units?
As the title suggests, I could neither find electric field strength, nor intensity in my boost/units/ folder (using Boost version: 1.67).
Do they have a naming I don't get, or is this indeed the case?
(for now, I wrote them myself, but I would have…
0
votes
1 answer
Mixed units with boost::units
In my program, I would like to take advantage of boost::units for type safe computations and automatic conversions. As a novice user of the library, I have a basic understanding of how it works, and why implicit type conversion is forbidden.
Right…
0
votes
0 answers
Converting given quantities to different system of base units
I'm trying to use boost-unit for one of my projects. In this project several quantities like velocity, accelaration, angular velocity are represented with SI-System base units. (m/s, m/s^2, rad/s^2)
The user uses a GUI Interface to plot these…
0
votes
0 answers
Override stream operator behavior for units
Today I used boost-units for the first time and I was really satisfied with the outcome.
Unfortunately, I'm not completely satisfied with the display of the operator<< for a given unit.
The following code prints m s^-2 on the console:
#include…
0
votes
1 answer
error C2039:'serialize': is not a member of 'boost::units::quantity'
How can I serialize a map with type electric_potential and double ??
In my code I have put these headers:
#include
#include
#include…