Boost logo

Boost Users :

Subject: [Boost-users] iterators and value_type in multi_array
From: HweeKuan Lee (hweekuan_at_[hidden])
Date: 2009-08-14 06:39:26


i'm new to boost, but use the standard template library a lot. I have
problems with the following code.

line 12: according to the reference, i should be able to do this, but cannot compile. compile error is very long, tell me if I should include them here.

my compiler: gcc version 4.0.1 (Apple Inc. build 5490)

thanks in advance for your help.

  1 #include <boost/multi_array.hpp>
  2
  3 int main ( ) {
  4
  5 typedef boost::multi_array<double,2> matrix_type;
  6 typedef matrix_type::iterator iterator;
  7
  8 matrix_type mat(boost::extents[2][3]);
  9 double v = .2;
 10
 11 for(iterator it=mat.begin();it!=mat.end();++it) {
 12 (*it) = v; // compile error
 13 }
 14 }

      


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net