|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2001-06-12 12:26:24
One problem with this is that it requires much more of the iterator in some
cases than it otherwise might. In an array stored as vectors of vectors
of... vectors, each iterator would need to have references to all of the
containing vectors.
-Dave
----- Original Message -----
From: <jcampbell3_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, June 12, 2001 12:49 PM
Subject: [boost] Re: matrix and vector iterators
> --- In boost_at_y..., Jeremy Siek <jsiek_at_r...> wrote:
> >
> > One thing that we need to decide on is the interface for traversing
> > vectors and matrices. I see a couple options:
> >
> > 1. MTL-style iterators
> >
> > *i // return a matrix/vector element
> > i.index() // return the index of the element pointed to (for
> vectors)
> > i.row() // return the row index (for matrices)
> > i.colummn() // return the column indexn (for matrices)
> Since the following:
>
> i.index(0) returns the index along "axis" 0 (row?)
> i.index(1) returns the index along "axis" 1 (col?)
> i.index(int n) returns index along "axis" n
>
> would work for any rank array, I recommend it. As another
> alternative:
>
> i.axis(n)++ would increment the index along axis n
> i.axis(n).index() would return index along axis n
>
> Of course in each of the above cases, the user could input
> an n>rank, resulting in coredump. Maybe the axis
> method could be specialized on template<unsigned n>class Axis
> to somehow avoid this.
>
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk