Boost logo

Boost Users :

From: ajb_at_[hidden]
Date: 2005-02-02 22:36:31


G'day all.

Quoting Ronald Garcia <garcia_at_[hidden]>:

> Yes they do, but not in the manner that you think they do :). In the
> code above, you are creating a 2 dimensional array. Calling begin() on
> your array results in an iterator over the /one-dimensional arrays/
> contained therein. Your code is trying to assign scalar values to
> one-dimensional arrays, hence the type error. You can get the effect
> that you are going for as follows.
>
> std::
> fill(test_array.data(),test_array.data()+test_array.num_elements(),1);

Which reminds me of a question I've been meaning to ask...

Any tips for dimension-independent programming with boost::multi_array?

In particular, it would be really nice to be able to iterate over the
elements in multi_array in such a way that the iterator also keeps
track of the index.

(This is for a real-world problem; I need to solve Poisson-esque problems
on regular grids, and it would be handy if I could get it happening in
either 2D or 3D by changing one template argument.)

Cheers,
Andrew Bromage


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