Boost logo

Boost :

From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2007-01-26 20:15:15


hmmm...decided to try and test this guy out and based on the docs I
would think the following code would compile, but it doesn't in VC++
8.0...g++ gobbles it up ok though.

#include <boost/units/quantity.hpp>
#include <boost/units/io.hpp>
#include <boost/units/systems/si_units.hpp>

using namespace boost::units;
using namespace boost::units::SI;

int const TEST_LIMIT = 5000000;

quantity<volume> f_mcs(quantity<length> x, quantity<length> y,
quantity<length> z)
{
   static quantity<length> const C = 3.14 * meters;

   quantity<volume> r = 0 * cubic_meters;
   for (int i = 0; i < TEST_LIMIT; ++i)
     r = r + ((x + y) * z * C);

   return r;
}

int main()
{
}

output:
1>profile_units.cpp
1>.\profile_units.cpp(22) : error C2752:
'boost::units::add_typeof_helper<X,Y>' : more than one partial
specialization matches the template argument list
1> with
1> [
1> X=boost::units::quantity<boost::units::SI::length>,
1> Y=boost::units::quantity<boost::units::SI::length>
1> ]
1> C:\Documents and
Settings\nroberts\Desktop\mcs_units_v0.5.5\units\boost/units/quantity.hpp(296):
could be
'boost::units::add_typeof_helper<boost::units::quantity<Unit,Y>,boost::units::quantity<Unit2,Y>>'
1> C:\Documents and
Settings\nroberts\Desktop\mcs_units_v0.5.5\units\boost/units/operators.hpp(71):
or 'boost::units::add_typeof_helper<X,X>'
1>.\profile_units.cpp(22) : error C2893: Failed to specialize function
template
'add_typeof_helper<boost::units::quantity<Unit,Y>,boost::units::quantity<Unit2,Y>>::type
boost::units::operator +(const boost::units::quantity<Unit,Y> &,const
boost::units::quantity<Unit2,Y> &)'
1> With the following template arguments:
1> 'boost::units::SI::length'
1> 'boost::units::SI::length'
1> 'double'
1> 'double'
1>.\profile_units.cpp(22) : error C2784:
'add_typeof_helper<boost::units::unit<System,Dim>,boost::units::unit<System,Dim2>>::type
boost::units::operator
+(boost::units::unit<System,Dim>,boost::units::unit<System,Dim2>)' :
could not deduce template argument for 'boost::units::unit<System,Dim>'
from 'boost::units::quantity<Unit>'
1> with
1> [
1> Unit=boost::units::SI::length
1> ]
1> C:\Documents and
Settings\nroberts\Desktop\mcs_units_v0.5.5\units\boost/units/unit.hpp(154)
: see declaration of 'boost::units::operator +'
1>.\profile_units.cpp(22) : error C2676: binary '+' :
'boost::units::quantity<Unit>' does not define this operator or a
conversion to a type acceptable to the predefined operator
1> with
1> [
1> Unit=boost::units::SI::length
1> ]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk