Boost logo

Boost :

From: Giovanni Bavestrelli (gibav_at_[hidden])
Date: 2000-12-01 17:12:53


--- In boost_at_[hidden], Jeremy Siek <jsiek_at_l...> wrote:
>
> On Thu, 30 Nov 2000, Jeremy Siek wrote:
> > 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.
>
> Just something to back up this intuition:
>
> It is natural to expect that a[i] be equivalent to *(a.begin() +
i). For
> this to be true for the multi-dim array, the iterators for higher
> dimensional slices need to dereference to give subarrays instead of
the
> flattened sections.

I agree with this, but if the number of dimensions grow, wouldn't
that force you to use complex sets of iterators? I still have to
finish reading Andrei Alexandrescu's October 98 CUJ article, but my
first impression is that with increasing N (number of dimensions) it
becomes complex. And if you return another iterator as you suggest,
how would you use, for example, std::max_element to find the maximum
element in a three dimensional slice of a five dimensional array?
Would it not be very complex? But you are right, I need to consider
this alternative, and see if I can come up with something simple and
that scales well to big number of dimensions. Any suggestion is
welcome.

> Ciao,
>
> Jeremy

Thanks, Jeremy!

Giovanni
 
>
> --------------------------------------------------------------------

--
>  Jeremy Siek                        www: 
http://www.lsc.nd.edu/~jsiek/
>  Ph.D. Candidate                  email: jsiek_at_l...
>  Univ. of Notre Dame         work phone: (219) 631-3906
> --------------------------------------------------------------------
--

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk