Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2001-06-15 09:46:48

Hubert HOLIN wrote:

> Somewhere in the E.U., le 15/06/2001
> --- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> >
> > ----- Original Message -----
> > From: "Hubert HOLIN" <Hubert.Holin_at_B...>
> > > >


> >
> > > An iterator is,
> > > basicaly, some form of bijection from a subset of N into the set of
> > > indices we are interested in.
> >
> > I'm not sure if that part rings true. Maybe you should clarify a bit.
> Well, bijection is too stringent. Injection is enough.
> Bijection is when we want to access each and every index one time, and
> one time only. Injection is when we only want to see some indices, but
> each index is accessed only once (in this case it is understood that
> this index is actually representative of a class, for instance the
> index may designate the "row", or "column" of a matrix, or a "cell" of
> a quadtree, or a "block" when we hav block matrices, or a "band" when
> we have band matrices). I believe we need at least injection (we do not
> want to see one index more then once in each traversal) in practice.
> The begining iterator is just the image of 0 by the
> injection, after the first increment we have the value of 1, etc. .
> > > A 'behaviour' is then simply some
> > > function from the set of indices to itself.
> >
> > Maybe you should give an example of what you've got in mind.
> A behaviour could be accessing each index in the order [0,0],
> [1,0],..., [N,0], [0,1],..., [N,M], another would be accessing in the
> order [0,0], [0,1],..., [0,N], [1,0],..., [N,M], yet another (when N ==
> M) would be acessing them in quadtree-key order.

I'm confused by "accessing each index". Do you mean accessing the
value corresponding to that index. For example, if the matrix is 'float A[N][M]`
and if 'i' is such an iterator, then starting from the initial value of i:
   *i == A[0][0]
    *(++i) == A[0][1]
   *(++i) == A[N][M]
In other words, the iterator produces a 'flattened' version or 'ravel' (apl term)
of A, and then access the elements just as a regular stl iterator. Is that
what you mean?


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