Hi,
what is the best way to make boost.units work together with
boost.interval. Something naive as
boost::numeric::intervalboost::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< quantitysi::length >,
boost::units::interval::checking_base< quantitysi::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::dimensionless_type>,
boost::units::homogeneous_system > > > > >, void>, double>]':
/g/g91/correaa/usr/include/boost/numeric/interval/checking.hpp:88:
instantiated from 'static T
boost::numeric::interval_lib::checking_no_empty::empty_lower() [with T =
boost::units::quantity >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system > > > > >, void>, double>, Checking
=
boost::numeric::interval_lib::checking_base >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system > > > > >, 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::set_empty() [with T =
boost::units::quantity >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system > > > > >, void>, double>, Policies
=
boost::numeric::interval_lib::policies >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system > > > > >, void>, double> >,
boost::numeric::interval_lib::checking_strict >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system > > > > >, void>, double> > >]'
/g/g91/correaa/usr/include/boost/numeric/interval/interval.hpp:171:
instantiated from 'boost::numeric::interval::interval(const T&, const T&) [with T =
boost::units::quantity >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system > > > > >, void>, double>, Policies
=
boost::numeric::interval_lib::policies >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system > > > > >, void>, double> >,
boost::numeric::interval_lib::checking_strict >,
boost::units::dimensionless_type>,
boost::units::homogeneous_system > > > > >, 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::dimensionless_type>,
boost::units::homogeneous_system > > > > >, void>,
double>::quantity(int)'
compilation terminated due to -Wfatal-errors.