Boost logo

Boost Users :

Subject: [Boost-users] [Units] Unable to raise constant to power of two
From: Stephen Torri (stephen.torri_at_[hidden])
Date: 2011-12-05 10:09:53


In the attached code I am trying to take a constant physical unit and
raise it to a power of two. The compiler is complaining that it cannot
find a template to satisfy multiply_typeof_helper. It says that there
are more than one partial specialization that matches the template
argument list. I read something on the web about there was no pow
operation for constants. The solution to that problem was to upgrade
to Boost 1.48. Unforunately I am constrained to using Boost 1.45. What
is an work around for this problem?

Here is the compiler output with the file attached:

1>------ Build started: Project: boost_units, Configuration: Debug Win32 ------
1>Compiling...
1>boost_units.cpp
1>C:\boost\boost/units/detail/static_rational_power.hpp(126) : error
C2752: 'boost::units::multiply_typeof_helper<X,Y>' : more than one
partial specialization matches the template argument list
1> with
1> [
1> X=boost::units::quantity<myproject::second_types::squared_radii_unit>,
1> Y=boost::units::one
1> ]
1> C:\boost\boost/units/quantity.hpp(689): could be
'boost::units::multiply_typeof_helper<boost::units::quantity<Unit1,T1>,Y>'
1> C:\boost\boost/units/detail/one.hpp(36): or
'boost::units::multiply_typeof_helper<T,boost::units::one>'
1> C:\boost\boost/units/detail/static_rational_power.hpp(93) :
see reference to class template instantiation
'boost::units::detail::static_int_power_impl<1,false>::apply<Y,R>'
being compiled
1> with
1> [
1> Y=boost::units::quantity<myproject::second_types::squared_radii_unit>,
1> R=boost::units::one
1> ]
1> C:\boost\boost/units/detail/static_rational_power.hpp(158) :
see reference to class template instantiation
'boost::units::detail::static_int_power_impl<N>::apply<Y,R>' being
compiled
1> with
1> [
1> N=2,
1> Y=boost::units::constant<boost::units::physical_constant<myproject::second_types::equatorial_radius_of_earth_t>>,
1> R=boost::units::one
1> ]
1> C:\boost\boost/units/detail/static_rational_power.hpp(187) :
see reference to class template instantiation
'boost::units::detail::static_int_power_sign_impl<N>::apply<Y>' being
compiled
1> with
1> [
1> N=2,
1> Y=boost::units::constant<boost::units::physical_constant<myproject::second_types::equatorial_radius_of_earth_t>>
1> ]
1> C:\boost\boost/units/pow.hpp(52) : see reference to class
template instantiation
'boost::units::detail::static_rational_power_impl<R,Y>' being compiled
1> with
1> [
1> R=boost::units::static_rational<2>,
1> Y=boost::units::constant<boost::units::physical_constant<myproject::second_types::equatorial_radius_of_earth_t>>
1> ]
1> ..\..\..\apps\boost_units\boost_units.cpp(104) : see
reference to class template instantiation
'boost::units::power_typeof_helper<X,Y>' being compiled
1> with
1> [
1> X=boost::units::constant<boost::units::physical_constant<myproject::second_types::equatorial_radius_of_earth_t>>,
1> Y=boost::units::static_rational<2>
1> ]
1>Build log was saved at "file://c:\documents and
settings\stephen.torri\my documents\visual studio
2008\projects\satsim_boost_units\vs2008\apps\boost_units\boost_units.dir\Debug\BuildLog.htm"
1>boost_units - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Regards,

Stephen




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