Boost logo

Boost :

From: Guillaume Melquiond (gmelquio_at_[hidden])
Date: 2002-10-17 15:37:48


On Thu, 17 Oct 2002, fernando_cacciola_at_[hidden] wrote:

> 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.

Thank you for finding this solution. It didn't occur to me that the
position of the line and the optimizations could induce such a behavior.

> 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

It seems I forgot interval.hpp during the last commit I did. In fact,
there is no more forward declaration in 'interval.hpp' since all the
headers are now independent. So there is no more duplicate or missing
declarations.

> 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));

Okay, I will fix it.

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

It's a good thing to hear.

> Regards,
>
> Fernando Cacciola

Thanks,

Guillaume


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