Boost logo

Boost :

Subject: Re: [boost] [multi_array] Bug in rbegin(), rend()?
From: Tushar Chowdhury (tchowdhury80_at_[hidden])
Date: 2009-05-20 00:45:44


Agreed John. Getting the same error here.

I believe it is a bug in the class <iterator_facade>

Lets see how the moderator reacts....

Cheers
Tushar
On 5/19/09, John Reid <j.reid_at_[hidden]> wrote:
> 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?
>
> John.
>
>
> /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>*)’
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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