[Boost-bugs] [Boost C++ Libraries] #3077: Reverse iterator compile-time bug in multi_array

Subject: [Boost-bugs] [Boost C++ Libraries] #3077: Reverse iterator compile-time bug in multi_array
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-05-25 10:47:28


#3077: Reverse iterator compile-time bug in multi_array
--------------------------------------------------------+-------------------
 Reporter: John Reid <john.reid_at_[hidden]> | Owner: garcia
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: multi_array
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: |
--------------------------------------------------------+-------------------
 I'm having some trouble iterating over a 2-dimensional multi_array in
 reverse order. I'm using boost 1.38 with gcc-4.2.4 and the following code
 won't compile with the error given below:

 {{{
 #include <boost/multi_array.hpp>

 template< typename It >
 void
 iterate_over( It begin, It end )
 {
     while( end != begin ) {
         begin->end() - begin->begin();
         ++begin;
     }
 }

 void
 test()
 {
     boost::multi_array< double, 2 > m;
     iterate_over( m.begin(), m.end() ); // works fine
     iterate_over( m.rbegin(), m.rend() ); // causes error
 }
 }}}


 This looks to me like a bug in the implementation of the reverse iterator
 for multi_array. Am I wrong? It is only a problem when
 iterator::operator-> is used. The (*begin). notation works fine.


 /home/john/Dev/ThirdParty/boost/boost_1_38_0/boost/iterator/iterator_facade.hpp:
 In static member function ‘static typename
 boost::mpl::if_<boost::is_reference<Reference>, Pointer,
 boost::detail::operator_arrow_proxy<ValueType> >::type
 boost::detail::operator_arrow_result<ValueType, Reference,
 Pointer>::make(Reference) [with ValueType = boost::multi_array<double,
 1ul, std::allocator<double> >, Reference =
 boost::detail::multi_array::sub_array<double, 1ul>, Pointer =
 boost::multi_array<double, 1ul, std::allocator<double> >*]’:
 /home/john/Dev/ThirdParty/boost/boost_1_38_0/boost/iterator/iterator_facade.hpp:648:
 instantiated from ‘typename boost::detail::operator_arrow_result<typename
 boost::detail::iterator_facade_types<Value, CategoryOrTraversal,
 Reference, Difference>::value_type, Reference, typename
 boost::detail::iterator_facade_types<Value, CategoryOrTraversal,
 Reference, Difference>::pointer>::type boost::iterator_facade<I, V, TC, R,
 D>::operator->() const [with Derived =
 boost::reverse_iterator<boost::detail::multi_array::array_iterator<double,
 double*, mpl_::size_t<2ul>, boost::detail::multi_array::sub_array<double,
 1ul> > >, Value = boost::multi_array<double, 1ul, std::allocator<double>
>, CategoryOrTraversal =
 boost::detail::iterator_category_with_traversal<std::input_iterator_tag,
 boost::random_access_traversal_tag>, Reference =
 boost::detail::multi_array::sub_array<double, 1ul>, Difference = long
 int]’
 src/sandbox/seqan_sandbox.cpp:12: instantiated from ‘void
 iterate_over(It, It) [with It =
 boost::reverse_iterator<boost::detail::multi_array::array_iterator<double,
 double*, mpl_::size_t<2ul>, boost::detail::multi_array::sub_array<double,
 1ul> > >]’
 src/sandbox/seqan_sandbox.cpp:22: instantiated from here
 /home/john/Dev/ThirdParty/boost/boost_1_38_0/boost/iterator/iterator_facade.hpp:326:
 error: no matching function for call to
 â€˜implicit_cast(boost::detail::multi_array::sub_array<double, 1ul>*)’

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3077>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC