Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2000-11-30 20:20:10

Hi Giovanni,

Hmm, my intuition is that when dereferencing the Array<int,2>::iterator
and Array<int,3>::iterator I should get a subarray, not an element. I
would rather have to explicitly request a "flattened" view to get what you
have here.

Also, have you though about adding access to arbitrary sub arrays, and
other kinds of slicing ala Blitz++?


On Wed, 29 Nov 2000, Giovanni Bavestrelli wrote:
> This kind of iteration is already possible in my Array as it is,
> since each SubArray has iterators, with their begin and end member
> functions. So, if you have a 3 dimensional array, you can traverse
> dimensions like this:
> Array<int,3> A3(ArraySizes(10)(20)(30)); // 3D Array of ints
> // Traverse through a monodimensional slice within the 3D array
> for (Array<int,1>::iterator i=A3[0][1].begin(),z=A3[0][1].end();i!
> =z;i++)
> *i=1;
> // Traverse through a bidimensional slice within the 3D array
> for (Array<int,2>::iterator i=A3[0].begin(), z=A3[0].end();i!=z;i++)
> *i=1;
> // Traverse through the complete 3D array
> for (Array<int,3>::iterator i=A3.begin(),z=A3.end();i!=z;i++)
> *i=1;

 Jeremy Siek www:
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906

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