Boost logo

Boost Users :

From: Antonio Piccolboni (piccolbo_at_[hidden])
Date: 2006-04-25 19:15:37


I guess what you want is origin(). Iterate from origin() to
origin+num_elements

Antonio

On 4/25/06, Greg Link <link_at_[hidden]> wrote:
>
> I'm using multi_array types as containers for some things I'm working
> on, and the number of dimensions can get quite large - often over 7,
> sometimes as high as 11. I'd like to do things such as initialize
> these multi_arrays, access all elements within them, and other such
> 'reasonable' operations.
>
> Thing is, the only iterator interface to multi_array returns a
> reference to the nested containers. Thus, to iterate over all sub-
> elements, I'm forced to have 7-11 nested for-loops to iterate over
> the entire thing.
>
> Is there an existent means of simply iterating over the entire set of
> data in the multi_array? Has anyone implemented such a thing, or is
> such a thing something to be desired within boost::multi_array? It
> seems like such a iterator would be especially useful if also
> implemented/supported within subgroups, allowing the user to define
> sub-ranges of the multi_array, then iterate over each element
> therein, without having to worry about dimensionality, et cetera.
>
> Any thoughts, ideas, or pointers to how to easily (without tons of
> code) iterate over an 11-dimensioned object is appreciated.
>
> In conclusion then, I've got two problems. One is "How can I simplify
> my each-element access to a high-dimensional multi_array", and the
> second is "Should there be a direct-to-element iterator in
> multi_array, and does the documentation adequately address the issue
> of whether or not an iterator points to elements directly or to a sub-
> graph?"
>
> Thanks for your time and troubles,
>
> - Greg Link
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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