[BGL] Structure for BFSvisitor is in header file (visitor & property confusion)??

I have my graph working with BFS, and a BFSvisitor. But, I don't want the
BFSvisitor to be in the header file. Since, it is, I have to declare properties
I want to use in the visitor, but then I have to pass them in in the constructor
for the class that contains the graph and the visitor structure ...
Here is my visitor (in .hpp):
/* ... other code */
/*! Structure for creating BFSvisitor
*
* The property maps are being assigned in the constructor for the
* Ann object - I don't know how inneficient of a method that is.
* i.e. if I should be using references.
*/
struct propagate_node : public boost::base_visitor

The full files are at: http://public.reducis.org/downloads/ann.hpp http://public.reducis.org/downloads/ann.cpp Also, if you see any other weird things that I'm doing with the graph library, let me know because I need to significantly improve my BGL/C++.

to pass my properties from the graph to the visitor ... there has to be a better way to do this. How can I put the visitor definition into the .cpp, and only declare it in the .hpp?
If the only place you're using the visitor is within the cpp file, then you just put it where it's being used. If you're going to be using the same visitor in multiple sources, it has to be in an hpp - unless you want to #include a cpp file, but that's not done very often. As for the rest... it looks okay, but I only really gave a cursory glance. Property maps are (almost) always passed by value, so you don't need to worry about keeping references to them. Andrew Sutton andrew.n.sutton@gmail.com
participants (2)
-
Andrew Sutton
-
Trevor Bain