[Units] another system problems

Hi, I used a previous version of the Units library to sketch out a fps system (foot-pound-second) that paralleled the cgs system, and the code compiled and ran fine. I am now returning to this effort, and I want to wrap it into a coordinate transform package, but I can no longer get the code to compile. I am using the latest code from the Boost sandbox, and MS Visual Studio with WinXP. The problem appears to be in the conversions, but I don't see what is missing when compared to cgs. typedef unit<length_dimension, SI::system > my_unit; typedef quantity< my_unit, ofs::Real64 > linear_measure; linear_measure dummy(200.0*CGS::centimeter); // implicit conversion from SI::meter to CGS::centimeter linear_measure dummy2(200.0*FPS::foot); The first three lines work fine, but the last one generates 10 errors with my compiler (MSVC 8.0). The first error is boost/units/detail/conversion_impl.hpp(342) : error C2039: 'type' : is not a member of 'boost::units::detail::call_base_unit_converter<Source,Dest>' with [ Source=boost::units::foot_base_unit, Dest=boost::units::unit<boost::units::length_dimension,boost::units::heterogeneous_system<boost::units::heterogeneous_system_pair<boost::units::dimension_list<boost::units::heterogeneous_system_dim<boost::units::meter_base_unit,boost::units::static_rational<1>>,boost::units::dimensionless_type>,boost::units::length_dimension>>> ] boost/units/detail/conversion_impl.hpp(536) : see reference to class template instantiation 'boost::units::detail::conversion_impl<N>::apply<Begin,DestinationSystem>' being compiled with [ N=1, Begin=boost::units::dimension_list<boost::units::heterogeneous_system_dim<boost::units::foot_base_unit,boost::units::static_rational<1>>,boost::units::dimensionless_type>, DestinationSystem=boost::units::homogeneous_system<boost::units::dimension_list<boost::units::meter_base_unit,boost::units::dimensionless_type>> ] boost/units/detail/conversion_impl.hpp(216) : see reference to class template instantiation 'boost::units::detail::conversion_factor_helper<Source,Dest>' being compiled with [ Source=boost::units::unit<boost::units::length_dimension,boost::units::heterogeneous_system<boost::units::heterogeneous_system_pair<boost::units::dimension_list<boost::units::heterogeneous_system_dim<boost::units::foot_base_unit,boost::units::static_rational<1>>,boost::units::dimensionless_type>,boost::units::length_dimension>>>, Dest=boost::units::unit<boost::units::length_dimension,boost::units::heterogeneous_system<boost::units::heterogeneous_system_pair<boost::units::dimension_list<boost::units::heterogeneous_system_dim<boost::units::meter_base_unit,boost::units::static_rational<1>>,boost::units::dimensionless_type>,boost::units::length_dimension>>> ] boost/units/detail/conversion_impl.hpp(324) : see reference to class template instantiation 'boost::units::detail::call_base_unit_converter_base_unit_impl<false,false>::apply<Source,Dest>' being compiled with [ Source=boost::units::foot_base_unit, Dest=boost::units::meter_base_unit ] boost/units/detail/conversion_impl.hpp(342) : see reference to class template instantiation 'boost::units::detail::call_base_unit_converter<Source,Dest>' being compiled with [ Source=boost::units::foot_base_unit, Dest=boost::units::unit<boost::units::length_dimension,boost::units::heterogeneous_system<boost::units::heterogeneous_system_pair<boost::units::dimension_list<boost::units::heterogeneous_system_dim<boost::units::meter_base_unit,boost::units::static_rational<1>>,boost::units::dimensionless_type>,boost::units::length_dimension>>> ] boost/units/detail/conversion_impl.hpp(377) : see reference to class template instantiation 'boost::units::detail::conversion_impl<N>::apply<Begin,DestinationSystem>' being compiled with [ N=1, Begin=boost::units::dimension_list<boost::units::heterogeneous_system_dim<boost::units::foot_base_unit,boost::units::static_rational<1>>,boost::units::dimensionless_type>, DestinationSystem=boost::units::homogeneous_system<boost::units::dimension_list<boost::units::meter_base_unit,boost::units::dimension_list<boost::units::scaled_base_unit<boost::units::gram_base_unit,boost::units::scale<10,boost::units::static_rational<3>>>,boost::units::dimension_list<boost::units::second_base_unit,boost::units::dimension_list<boost::units::ampere_base_unit,boost::units::dimension_list<boost::units::kelvin_base_unit,boost::units::dimension_list<boost::units::mole_base_unit,boost::units::dimension_list<boost::units::candela_base_unit,boost::units::dimension_list<boost::units::radian_base_unit,boost::units::dimension_list<boost::units::steradian_base_unit,boost::units::dimensionless_type>>>>>>>>>> ] boost/units/detail/conversion_impl.hpp(372) : while compiling class template member function 'boost::units::quantity<Unit,Y> boost::units::conversion_helper<From,To>::convert(const boost::units::quantity<boost::units::unit<Dim,System>,Y> &)' with [ Unit=my_unit, Y=ofs::Real64, From=boost::units::quantity<boost::units::unit<boost::units::length_dimension,boost::units::FPS::system>,double>, To=boost::units::quantity<my_unit,ofs::Real64>, Dim=boost::units::length_dimension, System=boost::units::FPS::system ] boost/units/quantity.hpp(167) : see reference to class template instantiation 'boost::units::conversion_helper<From,To>' being compiled with [ From=boost::units::quantity<boost::units::unit<boost::units::length_dimension,boost::units::FPS::system>,double>, To=boost::units::quantity<my_unit,ofs::Real64> ] testQuantifiedVector.cpp(47) : see reference to function template instantiation 'boost::units::quantity<Unit,Y>::quantity<boost::units::unit<Dim,System>,double>(const boost::units::quantity<boost::units::unit<Dim,System>,Y> &,void *)' being compiled with [ Unit=my_unit, Y=ofs::Real64, Dim=boost::units::length_dimension, System=boost::units::FPS::system ] Any guidance in this would be greatly appreciated. Pat

AMDG Patricia Hawley wrote:
Hi, I used a previous version of the Units library to sketch out a fps system (foot-pound-second) that paralleled the cgs system, and the code compiled and ran fine. I am now returning to this effort, and I want to wrap it into a coordinate transform package, but I can no longer get the code to compile. I am using the latest code from the Boost sandbox, and MS Visual Studio with WinXP. The problem appears to be in the conversions, but I don't see what is missing when compared to cgs.
typedef unit<length_dimension, SI::system > my_unit; typedef quantity< my_unit, ofs::Real64 > linear_measure; linear_measure dummy(200.0*CGS::centimeter); // implicit conversion from SI::meter to CGS::centimeter linear_measure dummy2(200.0*FPS::foot);
The first three lines work fine, but the last one generates 10 errors with my compiler (MSVC 8.0). The first error is
Can you post the definitions of FPS::foot, FPS::system &c. In Christ, Steven Watanabe

Steven Watanabe <watanabesj <at> gmail.com> writes:
AMDG
Can you post the definitions of FPS::foot, FPS::system &c.
In Christ, Steven Watanabe
Here is the definition for feet (using centimeters as an example): #ifndef BOOST_UNITS_FPS_LENGTH_HPP #define BOOST_UNITS_FPS_LENGTH_HPP #include <boost/units/systems/fps/base.hpp> namespace boost { namespace units { namespace FPS { typedef unit<length_dimension,FPS::system> length; BOOST_UNITS_STATIC_CONSTANT(foot,length); BOOST_UNITS_STATIC_CONSTANT(feet,length); } // namespace FPS } // namespace units } // namespace boost #endif // BOOST_UNITS_FPS_LENGTH_HPP Note: in the following I have a slug_base_unit, but I can't get this to work even if I strip out slugs and seconds, and only try working with feet. #ifndef BOOST_UNITS_FPS_BASE_HPP #define BOOST_UNITS_FPS_BASE_HPP #include <string> #include <boost/units/io.hpp> #include <boost/units/static_constant.hpp> #include <boost/units/unit.hpp> #include <boost/units/make_system.hpp> #include <boost/units/systems/base_units/foot.hpp> #include <boost/units/systems/base_units/slug.hpp> #include <boost/units/systems/base_units/second.hpp> namespace boost { namespace units { namespace FPS { // Note: called fps for foot-pound-second, but mass unit is slugs typedef make_system<foot_base_unit, slug_base_unit, second_base_unit>::type system; /// dimensionless FPS unit typedef unit<dimensionless_type,system> dimensionless; } // namespace FPS } // namespace units } // namespace boost #endif // BOOST_UNITS_FPS_BASE_HPP FPS is a fairly common system where I work, and although it is short for foot-pounds-seconds since pounds is a force, the mass unit is slugs. Pat

AMDG Patricia Hawley wrote:
#include <boost/units/systems/base_units/foot.hpp> #include <boost/units/systems/base_units/slug.hpp> #include <boost/units/systems/base_units/second.hpp>
For now #include <boost/units/systems/base_units.hpp> See my other email.
FPS is a fairly common system where I work, and although it is short for foot-pounds-seconds since pounds is a force, the mass unit is slugs.
BTW, it's okay to have a system that uses length, force, and time. In Christ, Steven Watanabe
participants (2)
-
Patricia Hawley
-
Steven Watanabe