Boost logo

Boost :

From: fernando_cacciola_at_[hidden]
Date: 2002-10-17 15:10:30


Hi Guillaume,

I just now managed to be able to look at the interval library.

I am unable to use bjam with my BCB+Boost installation... I've given up...
but I manually built test_execution_monitor.lib and created a BCB project
for each interval test (all taken from a fresh cvs update from boost and
checkout from boost-sandbox, late yesterday)

So...

In arith2.hpp, pow<> function, I moved the using declaration (using
interval_lib::detail::pow_aux),
to line 72, right before the first 'if':

template<class T, class Policies> inline
interval<T, Policies> pow(const interval<T, Policies>& x, int pwr)
{
  using interval_lib::detail::pow_aux; // <<<<<<<<<<<<<<<<<<<<<<<<<

  if (interval_lib::detail::test_input(x))
    return interval<T, Policies>::empty();
...

Apparently, since this first 'if' is true at compile-time in some cases, the
appearance of the using declaration in the unreachable section of the
function's body jokes this compiler.

I also found a mismatch between the functions 'equal' and 'overlap' as
forward declared in 'interval.hpp' and defined in 'utility.hpp'. I've fixed
that:

  // template<class T, class Traits>
  // bool equal(const interval<T,Traits>& x, const interval<T,Traits>& y);

  template<class T, class Policies1, class Policies2>
    bool equal(const interval<T, Policies1>& x, const interval<T,
Policies2>& y) ;

  // template<class T, class Traits>
  // bool overlap(const interval<T,Traits>& x, const interval<T,Traits>&
y);

  template<class T, class Policies1, class Policies2>
    bool overlap(const interval<T, Policies1>& x,
                 const interval<T, Policies2>& y) ;

Lastly, the function widen<>, in 'utility.hpp':

template<class T, class Policies> inline
interval<T, Policies> widen(const interval<T, Policies>& x, const T& v) ;

is not forward declared in 'interval.hpp'; but besides that, the code that
uses it in 'io.hpp':

line 58: interval<T, Policies> r_wide = widen(r, eps / 2.0);

cannot bound 'eps / 2.0' which is of type double with 'const T&', so a
specialization is not found.
The fix requires a simple cast:

  interval<T, Policies> r_wide = widen(r, static_cast<T>(eps / 2.0));

With the above changes, ALL 11 tests compiled and run successfully both in
debug and release modes with bcc5.5.1

Regards,

Fernando Cacciola


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk