Boost logo

Boost :

From: Andrew Lumsdaine (lums_at_[hidden])
Date: 2001-06-11 20:56:52


> > *i ?? // returns a matrix or vector element object.
> > value(i) // return the element value
> > row(i) // returns the row index
> > column(i) // return the column index
> > index(i) // return the index (for vectors)
>
> Yes, I like this.

One thing Jeremy and I had tossed around some time ago while trying to get a
handle on what is a matrix is that a matrix could be viewed as a
doubly-indexed associative container. If this seems like an interesting or
reasonable view of a matrix, then the iterator interface might look
something like std::map, but in this case the value type would be a triple
(key1, key2, value) instead of a pair. The tuple library might have some
bearing on the interface in this case.

So here is a question. Are the following semantically equivalent (is the
difference only syntax)? Is there any reason to choose one over the other?

*i.first
row(*i)
row(i)

*i.second
col(*i)
col(i)

*i.third
val(*i)
val(i)

I think the third option (row(i), col(i), val(i)) makes for the more general
case of a triple, but perhaps it would be too general?

Again, it might be interesting to throw some algorithms around to see if
anything interesting falls out in comparing and contrasting these.


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