Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-06-22 02:05:19


I'm proposing patches for two problems CW 8.3 is currently
having with multi_array:

1. CW 8.3 does not support the default arg in the following declaration
of a member function of index_range (boost/multi_array/index_rang.hpp):

index get_start(index low_index_range = index_range::from_start()) const

unless index_range::from_start() has been previously declared, which has

not in the current codebase. The fix consists simply in moving
from_start
upward inside the definition of index_range, see attached file
index_range.hpp.diff. This fix is absolutely innocent and cannot break
other compilers.

2. In CW 8.3, std::ptrdiff_t is *not* int, which, combined with the fact

that this compiler does not support SFINAE, makes the line 243
of libs/multi_array/test/generative_tests.hpp

    A.reindex(1);

to unintendedly resolve to a call to this overload of
const_multi_array_ref:

  // disabled for integral types in SFINA-capable compilers
  template <class BaseList> void reindex(const BaseList& values);

The fix consists in modifying generative_tests.hpp so as to make
sure we are calling the overload of reindex taking a
boost::multi_array_types::index value:

#ifdef BOOST_NO_SFINAE
    typedef boost::multi_array_types::index index;
    A.reindex(index(1));
#else
    A.reindex(1);
#endif

See the attached patch file generative_tests.hpp.diff.
Curiously enough, the typedef above was already defined, but not used,
in the CVS version of generative_tests.hpp, which leads me to think
that the author was thinking of this problem but somehow forgot about it

before making effective use of the typedef.

Is there any objection to these two patches being commited to the
trunk and RC_1_34_0 branch?

Thank you,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

33a34,40
> private:
> static index from_start()
> { return (std::numeric_limits<index>::min)(); }
>
> static index to_end()
> { return (std::numeric_limits<index>::max)(); }
>
135,140d141
< private:
< static index from_start()
< { return (std::numeric_limits<index>::min)(); }
<
< static index to_end()
< { return (std::numeric_limits<index>::max)(); }

51a52
> #include <boost/config.hpp> /* BOOST_NO_SFINAE */
241a243
> #ifdef BOOST_NO_SFINAE
243c245,248
< A.reindex(1);

---
>     A.reindex(index(1));
> #else
>     A.reindex(1);
> #endif 

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