Boost logo

Boost Users :

Subject: [Boost-users] [interval][units] interval operators not working when inteval elements are quantities
From: alfC (alfredo.correa_at_[hidden])
Date: 2012-01-26 03:15:15


Hi,

  Does anybody know what is missing in the boost.interval (or in the
boost.units) to allow these operation. It seems that there is no other way
than to make "interval/arith.hpp:operator/" more generic. -- Thanks, Alfredo

#include<boost/units/systems/si.hpp>
#include "alf/boost/units/interval.hpp"

int main(){
    boost::numeric::interval<double> iv(1.,10.);
    clog << iv << " " << 1./iv << endl; // ok, gives [1., 10] and [0.1,1.]

    boost::numeric::interval<quantity<si::length> > iv2(1.*si::meter,
10.*si::meter);
    clog << iv2 << " " << 1./iv2 << endl; // error: no match for
‘operator/’ in ‘1.0e+0 / iv2’

    return 0;
}



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