Boost logo

Boost Users :

Subject: [Boost-users] BGL defining my own iterator?
From: Anders Wallin (anders.e.e.wallin_at_[hidden])
Date: 2011-12-22 08:59:28


Hi all,

For traversing the faces of a planar BGL graph I store 'next' pointers
in a bundled property for each edge.
I can go round a face of the graph like this:
BGLGraph g;
edge_descriptor current,start; // initialize these!
do {
   // do something with current
  current=g[current].next;
} while(current!=start);

Now I was thinking that a lot of 'boilerplate' code would be
eliminated if I could do these loops with BOOST_FOREACH.
Following the tutorial for iterator_facade I am trying something like this:
https://github.com/aewallin/sandbox/blob/master/bgl_iterator/main.cpp

However as commented in the code it doesn't quite work. I get either
no iterations, one iteration, or all but one edge.

Also, holding a pointer to an edge_descriptor in the iterator class
doesn't strike me as very elegant, could I store an edge_descriptor
directly?

suggestions?

thanks,
AW


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