On Tue, Mar 1, 2011 at 10:19 PM, Ryan <mccorywork@gmail.com> wrote:
Is it possible to create a quantity with a specific type of dimension value?
With some digging I've found that it's possible.
using namespace boost::units;
using namespace boost::units::si;
quantity<length> L = 2.0*meters;
//Is it possible to have meters instead of length as a quantity?
quantity<???> L = 2.0 * meters;
quantity<meter_base_unit::unit_type> L = 2.0 * meters;
This quantity though doesn't naturally allow addition with quantity<length>.
quantity<length> L = 2.0 * meters;
quantity<meter_base_unit::unit_type> M = 3.0 * meters;
quantity<length> N = L + M;
This doesn't compile. The error is "Failed to specialize function template 'add_typeof_helpter'". If I explicit cast M to quantity<length> the code compiles. The si::length is the meter. So why is this occuring?
Ryan