title: CPP Boost Visitor Multi Target
body: <p>I have the following problem. I would like to use the DIJKSTRA algorithm from boost. Furthermore, I would like to stop the search when I hit a certain target node. My first implementation works fine for a single target node:</p>
  
  <pre><code>vertex_descriptor src = vertex(start_vertex, g); //start_node
  vertex_descriptor targ = vertex(end_vertex, g); //end_node
  try {
  dijkstra_shortest_paths(g, src,predecessor_map(&amp;p[0]).distance_map(&amp;d[0]).visitor(target_visit(targ,on_examine_vertex())));
  }
  catch( ... ) {}
  </code></pre>
  
  <p>with following visitor:</p>
  
  <pre><code>template &lt;class Vertex, class Tag&gt;struct target_visitor : public default_dijkstra_visitor{
  target_visitor(Vertex u) : v(u) { }
  template &lt;class Graph&gt;
  void examine_vertex(Vertex u, Graph&amp; g)
  {
      if( u == v ) {
          throw(-1);
      }
  }
  private:
      Vertex v;
  };
  template &lt;class Vertex, class Tag&gt;
  target_visitor&lt;Vertex, Tag&gt;target_visit(Vertex u, Tag) {
  return target_visitor&lt;Vertex, Tag&gt;(u);
  }
  </code></pre>
  
  <p>At the moment I can only treat single end nodes (vertex_descriptor targ). I would like to change my code that a vector of end nodes is allowed. Then the visitor should stop if one of the end_nodes is reached. 
  Can someone help me to modify this?
  Everytime I tried to change the type of targ into something like vector I get a problem with the vistor template?</p>
  
  <p>Regards,
  Chris</p>