Boost logo

Boost Users :

Subject: [Boost-users] [fusion - I think!] Multiple nested range traversal.
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2009-01-12 08:25:03


I recently asked a question on here about traversal of multiple indices,
which
produced a luke-warm reaction, mainly because I wasn't really asking
the right question!

So here's another try. Consider a bit of code like this

for ( unsigned i=0; i!=3; ++i )
  for ( unsigned j=2; j!=5;++j )
    for ( unsigned k=4;k!=10;++k )
      f( i, j, k );

I'd guess this comes up pretty often, and by generalising it to

* an arbitrary number of ranges, of arbitrary types
* f() implemented as a lambda or bind function

would have quite wide applicability.

I've considered writing an implemetation, which has dragged me
into examining fusion and mpl in some detail, but doing so does
not seem to me be trivial at all.

Is there already something in Boost which does this?

Thanks, Rob.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net