
Compiling below, It's OK. but executing, visitors do nothing. What's the problem? Is this slicing problem? why? thank you in advance. ---------------------- below ------------------------ // bfs visitor 1. just printing every vertex in breath first order. struct graph_printer1 : public default_bfs_visitor { template<typename Vertex, typename Graph> void discover_vertex(Vertex u, Graph& g) { cout << " graph printer 1" << u <<"\n"; } }; // bfs visitor 2. same as visitor 1 except message. struct graph_printer2 : public default_bfs_visitor { template<typename Vertex, typename Graph> void discover_vertex(Vertex u, Graph& g) { cout << " graph printer 2" << u <<"\n"; } }; // graph wrapper class graph_wrapper { protected: adjacency_list<vecS, vecS, bidirectionalS, VertexProperty, EdgeProperty> m_graph; public: // HERE. this Visit function does nothing.!! void Visit(default_bfs_visitor* vis, int vertexID ) { breadth_first_search(m_graph, vertex(vertexID, m_graph), visitor(*vis)); } }; int main() { graph_wrapper holder; graph_printer1 vis1; graph_printer2 vis2; holder.Visit(&vis1); holder.Visit(&vis2); return 0; } ---------------------------------------- Ki-Soo, Park e-mail: park@erhouse.co.kr wfms123@hotmail.com
participants (1)
-
�ڱ��