Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::units primer explained / conversion factors required
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2011-07-22 13:03:59


On 7/22/2011 9:43 AM, Michael Powell wrote:
> With this approach, we're getting a compilation error. Not sure what
> we're doing wrong.
>
> #include <boost/units/systems/si.hpp>
> using namespace boost::units;
> using boost::units::si::mass;
> using boost::units::si::pressure;
> using boost::units::si::length;
> using boost::units::si::mass_density;
> using boost::units::si::pascals;
> using boost::units::si::meter;
> using boost::units::si::kilograms_per_cubic_meter;
>
> typedef derived_dimension<length_base_dimension, 1,
> time_base_dimension, -2>::type si_hsp_conversion_constant_factor;

In my calculations I said length was to -1.

>
> Error 1 error C2440: 'initializing' : cannot convert from
> 'boost::units::quantity<Unit,Y>' to 'boost::units::quantity<Unit,Y>'
> c:\Source\SafetyValve2011\CS.Calculations\calcs\hsp.cpp 100
> CS.Calculations

You've got a dimension mismatch. You should have a large block of
template looking vomit in your errors. If you format those you can see
what kind of conversion is being attempted and then you'll see the true
dimensions of your equation.


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