Boost logo

Boost Users :

From: ¹Ú±â¼ö (yg-boost-users_at_[hidden])
Date: 2002-06-11 04:34:11


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_at_[hidden]
           wfms123_at_[hidden]


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