
16 Dec
2009
16 Dec
'09
1:52 p.m.
My problem: size of the finishingOrder vector is zero outside the my_visitor::finish_vertex method. I checked its size inside the my_visitor::finish_vertex method and its value is increasing...
All visitors have to be copy constructible and depth_first_search will operate on the copied object.
Actually, it's the fact that the visitor is copied that's causing the problem. The visitor needs to declare it's vector member as a reference (to a vector declared somewhere else). For example: struct my_visitor : default_dfs_visitor { my_visitor(vector<Vertex>& order) : finishingOrder(order) { } vector<Vertex>& finishingOrder; }; Andrew Sutton andrew.n.sutton@gmail.com