
Have a look at VSIPL++ ( Vector, Signal, and Image Processing Library http://www.vsipl.org/ ), the spec is here ( http://www.hpec-si.org/spec-1.0-cand-revD.pdf ), and an open source implementation is available if you're interested. VSIPL++ supports 1, 2, and 3 dimensional containers. Domain objects represent sets of indices that correspond to a sub-view of the container. An N dimensional Domain contains a 1D domain for each dimension. If nothing else it may be helpful to see how others have approached the problem. Glenn Schrader Neal Becker wrote:
What I am looking for is:
* A generalization of range to multi-dim (starting with, at minimum, 2d)
* What makes range useful? The ability to generically traverse containers, accessing (ro/rw) the elements.
The example I gave has an interface that looks like vector<vector>>, but that is a result of thinking about how I would like a generalization of range traversal to look.
I didn't state it, but I imagine the 2d range would also support traversal by columns, and maybe other types of traversal. The row/col example was just an example (but a common one).
Of course, not all 2d ranges would support all kinds of traversal.