dijkstra_shortest_paths Boost Graph Lib 1.57.0失败

时间:2014-12-20 03:41:58

标签: c++ boost stl dijkstra boost-property-map

我正在使用BGL,最近从1.46.1迁移到1.57.0。我也从使用Mac上的Xcode切换到gcc 4.9.2。

我得到一个没有匹配的函数调用来获取并创建了这个小代码来说明问题。如果我将INCLUDE路径更改为1.46.1,则此代码运行良好,它在1.55.0和1.57.0上失败。

任何建议表示赞赏。 感谢。


#include <boost/config.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>

struct EdgeDef
{
  double dist;
  double prop1;
};

typedef boost::adjacency_list < boost::listS, boost::vecS, boost::directedS,boost::no_property,EdgeDef > Graph;

int main() {
    Graph g;


    std::vector<double> d(num_vertices(g));
    std::vector<Graph::vertex_descriptor> p(num_vertices(g));

    Graph::vertex_descriptor s = 0;
    dijkstra_shortest_paths(g,s,
                            boost::predecessor_map(&p[0]).distance_map(&d[0]).
                            weight_map(get(&EdgeDef::dist,g)));
}

使用gcc构建的错误日志

2:37:37 **** Incremental Build of configuration Debug for project TestBGL ****
make all 
Building file: ../src/TestBGL.cpp
Invoking: GCC C++ Compiler
/usr/local/bin/g++-4.9 -I/Users/flyboy777/Downloads/boost_1_57_0 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/TestBGL.d" -MT"src/TestBGL.d" -o "src/TestBGL.o" "../src/TestBGL.cpp"
In file included from ../src/TestBGL.cpp:6:0:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp: In instantiation of 'void boost::detail::dijkstra_bfs_visitor<UniformCostVisitor, UpdatableQueue, WeightMap, PredecessorMap, DistanceMap, BinaryFunction, BinaryPredicate>::gray_target(Edge, Graph&) [with Edge = boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>; Graph = const boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; UniformCostVisitor = boost::dijkstra_visitor<>; UpdatableQueue = boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; PredecessorMap = long unsigned int*; DistanceMap = double*; BinaryFunction = boost::closed_plus<double>; BinaryPredicate = std::less<double>]':
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/breadth_first_search.hpp:87:47:   required from 'void boost::breadth_first_visit(const IncidenceGraph&, SourceIterator, SourceIterator, Buffer&, BFSVisitor, ColorMap) [with IncidenceGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; Buffer = boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >; BFSVisitor = boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >; ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int> >; SourceIterator = long unsigned int*]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:383:61:   required from 'void boost::dijkstra_shortest_paths_no_init(const Graph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistZero, DijkstraVisitor, ColorMap) [with Graph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistZero = double; ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int> >]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:478:34:   required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, ColorMap) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double; ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int> >]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:425:34:   required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double; T = char; Tag = boost::detail::unused_tag_type; Base = boost::no_property; typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:518:50:   required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:446:72:   required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double; T = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; Tag = boost::edge_weight_t; Base = boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int; typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:573:16:   required from 'void boost::detail::dijkstra_dispatch2(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Params = boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, boost::edge_weight_t, boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> > >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:595:35:   required from 'void boost::detail::dijkstra_dispatch1(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Params = boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, boost::edge_weight_t, boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> > >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:614:14:   required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, const boost::bgl_named_params<T, Tag, Base>&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; Param = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; Tag = boost::edge_weight_t; Rest = boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
../src/TestBGL.cpp:26:62:   required from here
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: error: no matching function for call to 'get(double*&, long unsigned int)'
         D old_distance = get(m_distance, target(e, g));
                                                      ^
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: note: candidate is:
In file included from /Users/flyboy777/Downloads/boost_1_57_0/boost/graph/transpose_graph.hpp:16:0,
                 from /Users/flyboy777/Downloads/boost_1_57_0/boost/graph/strong_components.hpp:262,
                 from ../src/TestBGL.cpp:5:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/reverse_graph.hpp:433:3: note: template<class E> E boost::detail::get(boost::detail::underlying_edge_desc_map_type<E>, const boost::detail::reverse_graph_edge_descriptor<EdgeDesc>&)
   get(underlying_edge_desc_map_type<E> m,
   ^
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/reverse_graph.hpp:433:3: note:   template argument deduction/substitution failed:
In file included from ../src/TestBGL.cpp:6:0:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: note:   mismatched types 'boost::detail::underlying_edge_desc_map_type<E>' and 'double*'
         D old_distance = get(m_distance, target(e, g));
                                                      ^
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp: In instantiation of 'void boost::detail::dijkstra_bfs_visitor<UniformCostVisitor, UpdatableQueue, WeightMap, PredecessorMap, DistanceMap, BinaryFunction, BinaryPredicate>::gray_target(Edge, Graph&) [with Edge = boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>; Graph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; UniformCostVisitor = boost::dijkstra_visitor<>; UpdatableQueue = boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; PredecessorMap = long unsigned int*; DistanceMap = double*; BinaryFunction = boost::closed_plus<double>; BinaryPredicate = std::less<double>]':
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/breadth_first_search.hpp:45:7:   required from 'void boost::BFSVisitorConcept<Visitor, Graph>::constraints() [with Visitor = boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >; Graph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/concept/detail/has_constraints.hpp:32:62:   required by substitution of 'template<class Model> boost::concepts::detail::yes boost::concepts::detail::has_constraints_(Model*, boost::concepts::detail::wrap_constraints<Model, (& Model:: constraints)>*) [with Model = boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> >]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/concept/detail/has_constraints.hpp:42:5:   required from 'const bool boost::concepts::not_satisfied<boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> > >::value'
/Users/flyboy777/Downloads/boost_1_57_0/boost/concept/detail/has_constraints.hpp:45:31:   required from 'struct boost::concepts::not_satisfied<boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> > >'
/Users/flyboy777/Downloads/boost_1_57_0/boost/mpl/if.hpp:67:11:   required from 'struct boost::mpl::if_<boost::concepts::not_satisfied<boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> > >, boost::concepts::constraint<boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> > >, boost::concepts::requirement<boost::concepts::failed************ boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> >::************> >'
/Users/flyboy777/Downloads/boost_1_57_0/boost/concept/detail/general.hpp:50:8:   [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:518:50:   required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:446:72:   required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double; T = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; Tag = boost::edge_weight_t; Base = boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int; typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:573:16:   required from 'void boost::detail::dijkstra_dispatch2(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Params = boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, boost::edge_weight_t, boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> > >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:595:35:   required from 'void boost::detail::dijkstra_dispatch1(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Params = boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, boost::edge_weight_t, boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> > >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:614:14:   required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, const boost::bgl_named_params<T, Tag, Base>&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; Param = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; Tag = boost::edge_weight_t; Rest = boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
../src/TestBGL.cpp:26:62:   required from here
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: error: no matching function for call to 'get(double*&, long unsigned int)'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: note: candidate is:
In file included from /Users/flyboy777/Downloads/boost_1_57_0/boost/graph/transpose_graph.hpp:16:0,
                 from /Users/flyboy777/Downloads/boost_1_57_0/boost/graph/strong_components.hpp:262,
                 from ../src/TestBGL.cpp:5:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/reverse_graph.hpp:433:3: note: template<class E> E boost::detail::get(boost::detail::underlying_edge_desc_map_type<E>, const boost::detail::reverse_graph_edge_descriptor<EdgeDesc>&)
   get(underlying_edge_desc_map_type<E> m,
   ^
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/reverse_graph.hpp:433:3: note:   template argument deduction/substitution failed:
In file included from ../src/TestBGL.cpp:6:0:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: note:   mismatched types 'boost::detail::underlying_edge_desc_map_type<E>' and 'double*'
         D old_distance = get(m_distance, target(e, g));
                                                      ^
make: *** [src/TestBGL.o] Error 1

22:37:39 Build Finished (took 2s.330ms)

1 个答案:

答案 0 :(得分:2)

您应该根据1.55中属性映射的更改来更新代码。 使用make_iterator_property_map代替原始指针:

 dijkstra_shortest_paths(g,s,
                         boost::predecessor_map(boost::make_iterator_property_map(p.begin(), get(boost::vertex_index, g))).
                         distance_map(boost::make_iterator_property_map(d.begin(), get(boost::vertex_index, g))).
                         weight_map(get(&EdgeDef::dist,g)));

请参阅changes in 1.55以及此错误https://svn.boost.org/trac/boost/ticket/7877