[BGL] visitors.hpp:138: error: no type named 'event_filter' in 'class dijkstra_custom_visitor'
Hi, Im trying to use a custom visitor but I get this error. My custom visitor is: class dijkstra_custom_visitor : public boost::default_dijkstra_visitor { public: dijkstra_threshold(glm::dvec3 source, double threshold): s(source), threshold(threshold) {} struct hit_threshold {}; void examine_vertex(boost::graph_traits <unGraph>::vertex_descriptor v, const unGraph& g) { glm::dvec3 dest = boost::get(&VertexProperties::m_mid_point, g, v); if( glm::distance(s,dest) > threshold ) throw hit_threshold(); } double threshold; glm::dvec3 s; }; My 'calling' line is: std::vector<Vertex> predecessors(boost::num_vertices(m_ugraph)); std::vector<Weight> distances(boost::num_vertices(m_ugraph), std::numeric_limits<double>::max() ); IndexMap indexMap = boost::get(boost::vertex_index, m_ugraph); PredecessorMap predecessorMap(&predecessors[0], indexMap); DistanceMap distanceMap(&distances[0], indexMap); glm::dvec3 s_mid = m_ugraph[*vertex_iterator_begin].m_mid_point; double thres = 500.0f; boost::dijkstra_shortest_paths(m_ugraph, *vertex_iterator_begin, boost::predecessor_map(predecessorMap).distance_map(distanceMap).visitor(boost::make_dijkstra_visitor(dijkstra_custom_visitor(s_mid,thres)))); What do you think is the problem? thanks
On Thu, 21 Nov 2013, The Maschine wrote:
Hi, Im trying to use a custom visitor but I get this error. My custom visitor is:
class dijkstra_custom_visitor : public boost::default_dijkstra_visitor { public: dijkstra_threshold(glm::dvec3 source, double threshold): s(source), threshold(threshold) {} struct hit_threshold {}; void examine_vertex(boost::graph_traits <unGraph>::vertex_descriptor v, const unGraph& g) { glm::dvec3 dest = boost::get(&VertexProperties::m_mid_point, g, v); if( glm::distance(s,dest) > threshold ) throw hit_threshold(); } double threshold; glm::dvec3 s; };
(snip)
boost::dijkstra_shortest_paths(m_ugraph, *vertex_iterator_begin, boost::predecessor_map(predecessorMap).distanc e_map(distanceMap).visitor(boost::make_dijkstra_visitor(dijkstra_custom_visitor(s_mid,thres))));
What do you think is the problem?
If you write a visitor with all of the members (and default_dijkstra_visitor fills in those that you didn't), you don't need to use make_dijkstra_visitor. Just use .visitor(dijkstra_custom_visitor(s_mid,thres)) in your call and see if it works. -- Jeremiah Willcock
participants (2)
-
Jeremiah Willcock
-
The Maschine