Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2006-09-22 19:01:03

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’

Boost list run by bdawes at, gregod at, cpdaniel at, john at