
Hi Rob,
Thanks for the response. I also think this is a pretty important use case
for this great library. Let me justify why I think an Iterator based
approach is the best:
* For maximum efficiency (I will be using this in numerical simulations), we
will want have an incrementing pointer within the data structure pointing to
the actual object, and not just the iterator.
* Also, if we have a single forward iterator, then we should be able to
reuse a bunch of standard algorithms in the cases where we do not need the
actual index values or the order of execution doesn't matter.
* In the iterator algorithm, I would love to check the ordering of the data
from the template parameters. If it is fortran ordering then we would do
the loops in the opposite order for example, and this should be based on
querying the data structure in the iterator code.
* As for your range based use case, I don't know enough about how iterators
and ranges interact to see how that would work.
* As to implementation of this, thanks for the pointer to Fusion. This
indeed seems to be the best approach since the loops can be generated at
compile time, and compilers could then do some very fancy optimization on
them. Sadly, I am not a template metaprogrammer, or a very good C++
programmer in general, and am terrified to learn it and lose sight of my
non-CS research.
Now for the semantics of this, it seems to me that the way the iterator
concepts are designed, the distance() function is intended to pass back the
related index information. Now my question is whether it is OK for the
semantics of distance to pass back a boost::array<NUMDIMS> instead? Seems
reasonable to me that it would not be based on passing back a scalar value
in this case because that is arbitrarily dependent on the column vs. row
ordering. And we can easily generate a boost::array from the distance
function by looking at the distance between the .begin() for all of our
current positions in the sub-iterators?
If the iterator framework was there and the distance implemented as vectors,
I can imagine the code looking like:
int n1 = 3;
int n2 = 4;
int n3 = 5;
boost::multi_array