Something strange with multi_array view iterator

The following test shows something strange. In the first test, a 1-dim view of a 1-dim array is created. Then the view iterators are used. In the second test, a 2-dim view of a 2-dim array is created. It seems the iterator in this case is not an iterator at all. Is this broken, or do I misunderstand something? -------------- #include <boost/multi_array.hpp> #include <algorithm> int main () { using boost::multi_array_types::index_range; typedef boost::multi_array<double,1> m1_t; m1_t m1; typedef m1_t::array_view<1>::type view1_t; view1_t v1 = m1[boost::indices[index_range()]]; std::fill (v1.begin(), v1.end(), 0); << This is fine typedef boost::multi_array<double,2> m2_t; m2_t m2; typedef m2_t::array_view<2>::type view2_t; view2_t v2 = m2[boost::indices[index_range()][index_range()]]; std::fill (v2.begin(), v2.end(), 0); << This is not } ----------------- There are lots of error messages, here is one: error: request for member ‘begin’ in ‘other’, which is of non-class type ‘const int’

Hi Neal, Your second test iterates over the first dimension of a 2-dimensional array and attempts to set each value to the integer "0". However, the value_types of these iterators are arrays, so a type error ensues. This error might be easier to notice with the addition of more concept checks to the library. I will look into this. Cheers, ron On Sep 22, 2006, at 7:01 PM, Neal Becker wrote:
The following test shows something strange.
In the first test, a 1-dim view of a 1-dim array is created. Then the view iterators are used.
In the second test, a 2-dim view of a 2-dim array is created. It seems the iterator in this case is not an iterator at all.
Is this broken, or do I misunderstand something?
-------------- #include <boost/multi_array.hpp> #include <algorithm>
int main () { using boost::multi_array_types::index_range;
typedef boost::multi_array<double,1> m1_t; m1_t m1;
typedef m1_t::array_view<1>::type view1_t;
view1_t v1 = m1[boost::indices[index_range()]];
std::fill (v1.begin(), v1.end(), 0); << This is fine
typedef boost::multi_array<double,2> m2_t; m2_t m2;
typedef m2_t::array_view<2>::type view2_t;
view2_t v2 = m2[boost::indices[index_range()][index_range()]];
std::fill (v2.begin(), v2.end(), 0); << This is not } ----------------- There are lots of error messages, here is one: error: request for member ‘begin’ in ‘other’, which is of non-class type ‘const int’
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/ listinfo.cgi/boost
participants (2)
-
Neal Becker
-
Ronald Garcia