c++boostinterval-arithmetic

Is there a built in function for length of boost::numeric::interval


I'm typing the following in my code

boost::numeric::interval<double> foo = ...;
double length = std::abs(foo.upper() - foo.lower());

It surprises me I can't find a simple utility in boost::numeric::interval that calculates the length. I'd expect a length function so that I can do

boost::numeric::interval<double> foo = ...;
double length = length(foo);

Is this either

Obviously I can write a simple inline function to do this but I'm a bit surprised that I have to given that I see functions like min and max


Solution

  • I just found it after I posted the question

    Answer is "width"

    boost::numeric::interval<double> foo = ...;
    double length = width(foo);