#include <iostream>
#include "boost/units/systems/si.hpp"
#include "boost/units/systems/si/io.hpp"
using boost::units::quantity;
using boost::units::si::torque;
using boost::units::si::newton_meter;
using boost::units::si::newton;
using boost::units::si::meter;
using boost::units::si::radian;
int main()
{
// works fine:
quantity tau0 = 0.0 * newton_meter;
// SURPRISE: compilation fails because newton_meter is not the
// same as newton*meter!
// quantity tau1 = 0.0 * newton * meter;
// Compilation succeeds even though the units on the RHS do not
// represent torque but torsional stiffness!
quantity tau2 = 0.0 * newton * meter / radian;
// newton * meter should give us a quantity with units of Newton-
// meters, i.e. m^2 kg s^-2. What this actually prints out is "0 J",
// which is reasonable since dimensionally J is the same as N m.
std::cout << boost::units::to_string(0.0 * newton * meter) << std::endl;
// One might hope that newton_meter would be the same thing as
// newton * meter. Instead, the result is "0 m^2 kg s^-2 rad^-1"
std::cout << boost::units::to_string(0.0 * newton_meter) << std::endl;
// The "torque" unit is also messed up in the same way.
std::cout << boost::units::to_string(torque()) << std::endl;
}