
On Tue, 6 Jul 2010, W.P. McNeill wrote:
I checked out the Boost trunk from http://svn.boost.org/svn/boost/trunk and rebuilt the program below using those headers. It builds and runs. From now on unless I say otherwise, everything I do uses this version of Boost. Next I tried to add distance and predecessor maps for the output. Following the astar-cities.cpp example, I implemented these as vectors. The program now looks like this:
#include
#include #include <iostream> #include <vector> using namespace boost;
typedef grid_graph<2> grid; typedef graph_traits<grid> traits; typedef traits::vertex_descriptor vertex_descriptor; typedef traits::edge_descriptor edge_descriptor;
typedef double edge_weight_type;
struct zero_heuristic:public boost::astar_heuristic
{ edge_weight_type operator()(vertex_descriptor v) { return 0; } };
int main (int argc, char const *argv[]) { array
sizes = {{ 3, 2 }}; grid g(sizes); shared_array_property_map ::const_type> weight(num_edges(g), get(edge_index, g)); std::vector p(num_vertices(g)); std::vector d(num_vertices(g)); vertex_descriptor start = vertex(0, g);
astar_search(g, start, zero_heuristic(), weight_map(weight). predecessor_map(&p[0]).distance_map(&d[0]) );
return 0; }
It now fails to compile because of what looks like a missing put() functions for the distance and predecessor maps. The top of the error spew looks contains a distance map error that looks like this:
You need to use iterator_property_map, not just a raw pointer, as your property map (for distance and predecessor maps). You can also use more shared_array_property_maps instead. -- Jeremiah Willcock