id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc
3077,Reverse iterator compile-time bug in multi_array,John Reid ,Jeremiah Willcock,"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
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_, Pointer, boost::detail::operator_arrow_proxy >::type boost::detail::operator_arrow_result::make(Reference) [with ValueType = boost::multi_array >, Reference = boost::detail::multi_array::sub_array, Pointer = boost::multi_array >*]’:
/home/john/Dev/ThirdParty/boost/boost_1_38_0/boost/iterator/iterator_facade.hpp:648: instantiated from ‘typename boost::detail::operator_arrow_result::value_type, Reference, typename boost::detail::iterator_facade_types::pointer>::type boost::iterator_facade::operator->() const [with Derived = boost::reverse_iterator, boost::detail::multi_array::sub_array > >, Value = boost::multi_array >, CategoryOrTraversal = boost::detail::iterator_category_with_traversal, Reference = boost::detail::multi_array::sub_array, 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::sub_array > >]’
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*)’ ",Bugs,assigned,Boost 1.40.0,multi_array,Boost 1.38.0,Problem,,,