在 boost 单元中,我通常通过乘以其中一个静态常量来赋值:
例如
using namespace boost::units;
quantity<si::angular_velocity> av = 0.5 * si::radians_per_second;
但是没有定义乘数常量怎么办呢?
例如这不会编译,因为未定义 boost::units::si::radians_per_second_per_second。
quantity<si::angular_acceleration> aa = 0.5 * si::radians_per_second_per_second;
最佳答案
正如@celtschk 在评论中建议的那样,可以通过对单位乘数应用正确的运算来分配单位:
quantity<si::angular_acceleration> aa = 0.5 * si::radians_per_second / si::seconds;
关于c++ - 如何为 boost::units::si::angular_acceleration 赋值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8796570/