|
Boost Users : |
Subject: [Boost-users] [units][interval] adapt boost.interval for boost.units
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-05-24 01:12:38
Hi,
what is the best way to make boost.units work together with
boost.interval. Something naive as
boost::numeric::interval<boost::units::quantity<boost::units::si::energy>
>
iv(3.*boost::units::si::meter, 4.*boost::units::si::meter);
doesn't compile because of an error in boost/numeric/interval/
checking.hpp (error attached below).
A work around is to do a typedef suggest by http://lists.boost.org/boost-users/2009/07/49493.php
typedef
boost::numeric::interval_lib::change_checking<
boost::numeric::interval< quantity<si::length> >,
boost::units::interval::checking_base< quantity<si::length> >
>::type
interval_length_type;
interval_length_type ival(3.*si::meter, 4.*si::meter);
which compiles.
do you think there is a better way?, that could allow for the first
syntax at the beginning of this message.
Thank you,
Alfredo
the compile error:
/g/g91/correaa/usr/include/boost/numeric/interval/checking.hpp: In
static member function 'static T
boost::numeric::interval_lib::checking_base<T>::empty_lower() [with T
=
boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double>]':
/g/g91/correaa/usr/include/boost/numeric/interval/checking.hpp:88:
instantiated from 'static T
boost::numeric::interval_lib::checking_no_empty<T, Checking,
Exception>::empty_lower() [with T =
boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double>, Checking
=
boost::numeric::interval_lib::checking_base<boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double> >,
Exception = boost::numeric::interval_lib::exception_create_empty]'
/g/g91/correaa/usr/include/boost/numeric/interval/interval.hpp:269:
instantiated from 'void boost::numeric::interval<T,
Policies>::set_empty() [with T =
boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double>, Policies
=
boost::numeric::interval_lib::policies<boost::numeric::interval_lib::rounded_math<boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double> >,
boost::numeric::interval_lib::checking_strict<boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double> > >]'
/g/g91/correaa/usr/include/boost/numeric/interval/interval.hpp:171:
instantiated from 'boost::numeric::interval<T,
Policies>::interval(const T&, const T&) [with T =
boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double>, Policies
=
boost::numeric::interval_lib::policies<boost::numeric::interval_lib::rounded_math<boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double> >,
boost::numeric::interval_lib::checking_strict<boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>, double> > >]'
lindhard.cpp:205: instantiated from here
/g/g91/correaa/usr/include/boost/numeric/interval/checking.hpp:63:
error: no matching function for call to
'boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::time_base_dimension,
boost::units::static_rational<-0x00000000000000001l, 1l> >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::atomic::electron_mass_base_unit,
boost::units::list<boost::units::atomic::elementary_charge_base_unit,
boost::units::list<boost::units::atomic::reduced_planck_constant_base_unit,
boost::units::list<boost::units::atomic::coulomb_force_constant_base_unit,
boost::units::list<boost::units::atomic::boltzman_constant_base_unit,
boost::units::dimensionless_type> > > > > >, void>,
double>::quantity(int)'
compilation terminated due to -Wfatal-errors.
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