dijkstra_shortest_paths Boost Graph Lib 1.57.0 fails - c++

I am using BGL and have recently migrated to 1.57.0 from 1.46.1. I also switched from using Xcode on a mac to gcc 4.9.2.
I am getting a no matching function call to get and have created this small snipet of code to illustrate the problem. If I change the INCLUDE path to be 1.46.1, this code works great, its on 1.55.0 and 1.57.0 that it fails.
Any advice appreciated.
Thanks.
#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)));
}
Error log from building with 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)

You should update your code according to changes in property maps in 1.55.
Use make_iterator_property_map instead of raw pointers:
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)));
See changes in 1.55 and this bug https://svn.boost.org/trac/boost/ticket/7877

Related

Boost Graph Library: Verification of ReadWritePropertyMapConcept for std::map fails

For some reason, verification of ReadWritePropertyMapConcept for std::map of vertex descriptors and colors fails:
Live on godbolt
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
#include <boost/property_map/property_map.hpp>
#include <map>
struct Vertex {};
using graph_type = boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, Vertex>;
using vertex_descriptor = boost::graph_traits<graph_type>::vertex_descriptor;
using map_type = std::map<vertex_descriptor, boost::default_color_type>;
BOOST_CONCEPT_ASSERT(
(boost::ReadWritePropertyMapConcept<map_type, vertex_descriptor>));
with errors:
In file included from /opt/compiler-explorer/libs/boost_1_78_0/boost/graph/adjacency_list.hpp:27,
from <source>:1:
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp: In instantiation of 'struct boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>':
/opt/compiler-explorer/libs/boost_1_78_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::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>]'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:42:5: required from 'const bool boost::concepts::not_satisfied<boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >::value'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:45:51: required from 'struct boost::concepts::not_satisfied<boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/general.hpp:72:8: required from 'struct boost::concepts::requirement_<void (*)(boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>)>'
<source>:13:1: required from here
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:203:54: error: no type named 'category' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
203 | typedef typename property_traits<PMap>::category Category;
| ^~~~~~~~
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp: In instantiation of 'struct boost::ReadablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>':
/opt/compiler-explorer/libs/boost_1_78_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::ReadablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>]'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:42:5: required from 'const bool boost::concepts::not_satisfied<boost::ReadablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >::value'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:45:51: required from 'struct boost::concepts::not_satisfied<boost::ReadablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/general.hpp:72:8: required from 'struct boost::concepts::requirement_<void (*)(boost::ReadablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>)>'
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:206:7: required from 'void boost::ReadWritePropertyMapConcept<PMap, Key>::constraints() [with PMap = std::map<long unsigned int, boost::default_color_type>; Key = long unsigned int]'
/opt/compiler-explorer/libs/boost_1_78_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::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>]'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:42:5: required from 'const bool boost::concepts::not_satisfied<boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >::value'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:45:51: required from 'struct boost::concepts::not_satisfied<boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/general.hpp:72:8: required from 'struct boost::concepts::requirement_<void (*)(boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>)>'
<source>:13:1: required from here
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:143:54: error: no type named 'key_type' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
143 | typedef typename property_traits<PMap>::key_type key_type;
| ^~~~~~~~
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:144:55: error: no type named 'reference' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
144 | typedef typename property_traits<PMap>::reference reference;
| ^~~~~~~~~
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:145:54: error: no type named 'category' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
145 | typedef typename property_traits<PMap>::category Category;
| ^~~~~~~~
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:154:48: error: no type named 'value_type' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
154 | typename property_traits<PMap>::value_type val;
| ^~~
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp: In instantiation of 'struct boost::WritablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>':
/opt/compiler-explorer/libs/boost_1_78_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::WritablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>]'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:42:5: required from 'const bool boost::concepts::not_satisfied<boost::WritablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >::value'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:45:51: required from 'struct boost::concepts::not_satisfied<boost::WritablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/general.hpp:72:8: required from 'struct boost::concepts::requirement_<void (*)(boost::WritablePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>)>'
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:207:7: required from 'void boost::ReadWritePropertyMapConcept<PMap, Key>::constraints() [with PMap = std::map<long unsigned int, boost::default_color_type>; Key = long unsigned int]'
/opt/compiler-explorer/libs/boost_1_78_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::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>]'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:42:5: required from 'const bool boost::concepts::not_satisfied<boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >::value'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:45:51: required from 'struct boost::concepts::not_satisfied<boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/general.hpp:72:8: required from 'struct boost::concepts::requirement_<void (*)(boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>)>'
<source>:13:1: required from here
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:176:54: error: no type named 'key_type' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
176 | typedef typename property_traits<PMap>::key_type key_type;
| ^~~~~~~~
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:177:54: error: no type named 'category' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
177 | typedef typename property_traits<PMap>::category Category;
| ^~~~~~~~
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:185:48: error: no type named 'value_type' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
185 | typename property_traits<PMap>::value_type val;
| ^~~
In file included from /opt/compiler-explorer/libs/boost_1_78_0/boost/concept/assert.hpp:35,
from /opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:19,
from /opt/compiler-explorer/libs/boost_1_78_0/boost/graph/adjacency_list.hpp:27,
from <source>:1:
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp: In instantiation of 'void boost::ReadWritePropertyMapConcept<PMap, Key>::constraints() [with PMap = std::map<long unsigned int, boost::default_color_type>; Key = long unsigned int]':
/opt/compiler-explorer/libs/boost_1_78_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::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>]'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:42:5: required from 'const bool boost::concepts::not_satisfied<boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >::value'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/has_constraints.hpp:45:51: required from 'struct boost::concepts::not_satisfied<boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int> >'
/opt/compiler-explorer/libs/boost_1_78_0/boost/concept/detail/general.hpp:72:8: required from 'struct boost::concepts::requirement_<void (*)(boost::ReadWritePropertyMapConcept<std::map<long unsigned int, boost::default_color_type>, long unsigned int>)>'
<source>:13:1: required from here
/opt/compiler-explorer/libs/boost_1_78_0/boost/property_map/property_map.hpp:208:7: error: no type named 'category' in 'struct boost::property_traits<std::map<long unsigned int, boost::default_color_type> >'
208 | BOOST_CONCEPT_ASSERT((ConvertibleConcept<Category, ReadWriteTag>));
| ^~~~~~~~~~~~~~~~~~~~
Compiler returned: 1
However, std::map surely has key_type, value_type etc. I have also used it in boost::depth_first_search() as color_map as in this question, and it seemed to work.
On the contrary, when the property map is constructed from adapter, the check passes:
int main() {
graph_type g;
std::vector<boost::default_color_type> colors(num_vertices(g));
auto color_map = boost::make_iterator_property_map(
colors.begin(), get(boost::vertex_index, g));
BOOST_CONCEPT_ASSERT(
(boost::ReadWritePropertyMapConcept<decltype(color_map),
boost::default_color_type>));
}
Why is the concept check failing?
A container doesn't usually satisfy the concept requirements for property maps. Put simply: the map is not a property map. At all.
In principle you need to adapt it. Certainly in the case of this associative property map:
std::map<V, C> colors;
auto color_map = make_assoc_property_map(colors);
Live On Compiler Explorer
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <fmt/ranges.h>
using C = boost::default_color_type;
template <> struct fmt::formatter<C> {
auto format(C c, auto& ctx) const { return format_to(ctx.out(), "{}", std::array{"white", "gray", "green", "red", "black"}.at(c)); }
};
struct Vertex {};
using G = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
Vertex>;
int main() {
using V = G::vertex_descriptor;
std::map<V, C> colors;
auto color_map = make_assoc_property_map(colors);
G g(10);
add_edge(0, 1, g);
add_edge(1, 3, g);
add_edge(1, 4, g);
add_edge(3, 2, g);
add_edge(2, 7, g);
breadth_first_search(g, vertex(0, g), boost::color_map(color_map));
fmt::print("{}\n", fmt::join(colors, "\n"));
}
Prints
(0, black)
(1, black)
(2, black)
(3, black)
(4, black)
(5, white)
(6, white)
(7, black)
(8, white)
(9, white)

boost multi_index_container not compiling

Trying to follow the boost docs on the usage of this, but am running into a snag.
Building on CentOS 7, g++ 4.8.5-28. Language standard: C++03
Working sample: https://godbolt.org/z/KPvjS_
My Code:
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/composite_key.hpp>
using namespace ::boost;
using namespace ::boost::multi_index;
typedef unsigned char UInt8;
typedef unsigned int UInt32;
typedef UInt8 ACCESSID[16];
class AccessID
{
public:
AccessID();
AccessID(const AccessID & id);
const std::size_t GetHash() const { return hashId;}
private:
ACCESSID id;
std::size_t hashId;
};
struct map_entry
{
UInt32 subject_hash;
UInt32 container;
AccessID clientAccessId;
AccessID serverAccessId;
map_entry( UInt32 parmHash
, UInt32 parmContainer
, AccessID &parmClientAccessId
, AccessID &parmServerAccessId )
: subject_hash( parmHash )
, container( parmContainer )
, clientAccessId( parmClientAccessId )
, serverAccessId( parmServerAccessId )
{
}
};
struct clientAccessId_extractor
{
typedef std::size_t result_type;
result_type operator ()( const map_entry &e ) const
{
// Hash is a boost::hash value.
return e.clientAccessId.GetHash();
}
};
struct serverAccessId_extractor
{
typedef std::size_t result_type;
result_type operator ()( const map_entry &e ) const
{
return e.serverAccessId.GetHash();
}
};
// Define the mapping relationships; like a "database" of sorts.
typedef multi_index_container<
map_entry,
indexed_by<
// Former "global" view.
ordered_unique<
composite_key<
map_entry,
member< map_entry, UInt32, &map_entry::container >,
serverAccessId_extractor
>
>,
// Regular lookup.
ordered_unique<
composite_key<
map_entry,
member< map_entry, UInt32, &map_entry::subject_hash >,
member< map_entry, UInt32, &map_entry::container >,
clientAccessId_extractor
>
>
>
> mapDb_t;
// Typedef the index types for easier reading.
typedef mapDb_t::nth_index< 0 >::type mapDb_by_serverAid;
typedef mapDb_t::nth_index< 1 >::type mapDb_by_clientAid;
class MappingClass
{
private:
// Index views.
mapDb_by_serverAid serverView;
mapDb_by_clientAid clientView;
// Index iterators.
mapDb_by_clientAid::iterator clientIter;
mapDb_by_serverAid::iterator serverIter;
// Define an object of the mapping db type.
mapDb_t mapDb;
public:
MappingClass() { };
~MappingClass() { };
};
And the error output from trying to compile:
$ g++ -fPIC -x c++ -c -Wno-unused-local-typedefs -Wall -Werror -O2 -m64 -D__EXTENSIONS__ -U_RWSTD_MULTI_THREAD -U_REENTRANT -DUSE_PTHREADS -DNDEBUG -DGCCBOOL -U_THREAD_SAFE -I/home/jearle/git//Open-Source/boost/1.51.0/common test_mi2.cpp -o test_mi2.o
test_mi2.cpp: In constructor ‘MappingClass::MappingClass()’:
test_mi2.cpp:110:20: error: no matching function for call to ‘boost::multi_index::detail::ordered_index<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >, boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >, boost::mpl::vector0<mpl_::na>, boost::multi_index::detail::ordered_unique_tag>::ordered_index( ’
MappingClass() { };
^
test_mi2.cpp:110:20: note: candidates are:
In file included from test_mi2.cpp:3:0:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:542:3: note: boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ordered_index(const boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>&) [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]
ordered_index(
^
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:542:3: note: candidate expects 1 argument, 0 provided
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:534:3: note: boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ordered_index(const ctor_args_list&, const allocator_type&) [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ctor_args_list = boost::tuples::cons<boost::tuples::tuple<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, boost::tuples::cons<boost::tuples::tuple<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, boost::tuples::null_type> >; typename SuperMeta::type::ctor_args_list = boost::tuples::cons<boost::tuples::tuple<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, boost::tuples::null_type>; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::allocator_type = std::allocator<map_entry>]
ordered_index(const ctor_args_list& args_list,const allocator_type& al):
^
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:534:3: note: candidate expects 2 arguments, 0 provided
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:558:3: error: ‘boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::~ordered_index() [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]’ is protected
~ordered_index()
^
test_mi2.cpp:110:20: error: within this context
MappingClass() { };
^
test_mi2.cpp:110:20: error: no matching function for call to ‘boost::multi_index::detail::ordered_index<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >, boost::mpl::vector0<mpl_::na>, boost::multi_index::detail::ordered_unique_tag>::ordered_index()’
test_mi2.cpp:110:20: note: candidates are:
In file included from test_mi2.cpp:3:0:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:542:3: note: boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ordered_index(const boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>&) [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]
ordered_index(
^
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:542:3: note: candidate expects 1 argument, 0 provided
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:534:3: note: boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ordered_index(const ctor_args_list&, const allocator_type&) [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ctor_args_list = boost::tuples::cons<boost::tuples::tuple<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, boost::tuples::null_type>; typename SuperMeta::type::ctor_args_list = boost::tuples::null_type; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::allocator_type = std::allocator<map_entry>]
ordered_index(const ctor_args_list& args_list,const allocator_type& al):
^
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:534:3: note: candidate expects 2 arguments, 0 provided
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:558:3: error: ‘boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::~ordered_index() [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]’ is protected
~ordered_index()
^
test_mi2.cpp:110:20: error: within this context
MappingClass() { };
^
In file included from test_mi2.cpp:3:0:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp: In destructor ‘MappingClass::~MappingClass()’:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:558:3: error: ‘boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::~ordered_index() [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]’ is protected
~ordered_index()
^
test_mi2.cpp:111:21: error: within this context
~MappingClass() { };
^
In file included from test_mi2.cpp:3:0:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:558:3: error: ‘boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::~ordered_index() [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]’ is protected
~ordered_index()
^
test_mi2.cpp:111:21: error: within this context
~MappingClass() { };
^
I don't really understand what the boost errors are, here. What have I missed?
The map index types are not default constructible, you need to change them to references and initialise them in your constructor:
class MappingClass
{
private:
// Define an object of the mapping db type.
mapDb_t mapDb;
// Index iterators.
mapDb_by_clientAid::iterator clientIter;
mapDb_by_serverAid::iterator serverIter;
// Index views.
mapDb_by_serverAid& serverView;
mapDb_by_clientAid& clientView;
public:
MappingClass()
:serverView( mapDb.get< 0 >() ),
clientView( mapDb.get< 1 >() ) { };
~MappingClass() { };
};
Note you also need to move mapDb to before the views so that it is initialised first.

boost::interprocess::map compiler error "cannot be overloaded"

I am getting a compiler error trying to use boost::interprocess:map and I do not understand the error.
Declaring the map and its allocator
using namespace boost::interprocess;
struct Order {
uint64_t id = 0;
uint64_t val = 0;
};
typedef std::pair<const uint64_t, Order> ValueType;
typedef allocator<ValueType,
managed_shared_memory::segment_manager> OrderMapAllocator;
typedef map<const uint64_t,
Order,
std::less<const uint64_t>,
OrderMapAllocator> OrderMap;
Example usage, the compiler error points out line 120 which is the first line of the function below:
OrderMap * _orders;
void addOrder(Order order) {
if(_orders->find(order.id) != _orders->end()){
/* stuff */
} else {
(*_orders)[order.id] = order;
}
}
Note, I previously ran the code using std::map successfully, with the key non const instead of const. I switched the key to const uint64_t because a type assertion in boost was failing.
Gets the compiler errors below which I cannot interpret
For conciseness, the first one ends:
boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
std::pair<iterator,bool> insert(const nonconst_value_type& x)
-
In file included from include/boost/interprocess/containers/map.hpp:23:0,
from src/app/SharedOrderBook.h:7,
from src/app/futures_feed.cpp:20:
include/boost/container/map.hpp: In instantiation of ‘class boost::container::map<const long unsigned int, Order, std::less<const long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >’:
src/app/SharedOrderBook.h:120:19: required from here
include/boost/container/map.hpp:541:29: error: ‘std::pair<typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator, bool> boost::container::map<Key, T, Compare, Allocator, Options>::insert(const nonconst_value_type&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
std::pair<iterator,bool> insert(const nonconst_value_type& x)
^~~~~~
include/boost/container/map.hpp:530:29: error: with ‘std::pair<typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator, bool> boost::container::map<Key, T, Compare, Allocator, Options>::insert(const value_type&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::value_type = std::pair<const long unsigned int, Order>]’
std::pair<iterator,bool> insert(const value_type& x)
^~~~~~
include/boost/container/map.hpp:574:29: error: ‘std::pair<typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator, bool> boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::value_type&&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
^~~~~~
include/boost/container/map.hpp:552:29: error: with ‘std::pair<typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator, bool> boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type&&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’
std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_value_type) x)
^~~~~~
include/boost/container/map.hpp:619:13: error: ‘boost::container::map<Key, T, Compare, Allocator, Options>::iterator boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator, const nonconst_value_type&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; boost::container::map<Key, T, Compare, Allocator, Options>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, true>; boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
iterator insert(const_iterator p, const nonconst_value_type& x)
^~~~~~
include/boost/container/map.hpp:586:13: error: with ‘boost::container::map<Key, T, Compare, Allocator, Options>::iterator boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator, const value_type&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; boost::container::map<Key, T, Compare, Allocator, Options>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, true>; boost::container::map<Key, T, Compare, Allocator, Options>::value_type = std::pair<const long unsigned int, Order>]’
iterator insert(const_iterator p, const value_type& x)
^~~~~~
include/boost/container/map.hpp:628:13: error: ‘boost::container::map<Key, T, Compare, Allocator, Options>::iterator boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator, boost::container::map<Key, T, Compare, Allocator, Options>::value_type&&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; boost::container::map<Key, T, Compare, Allocator, Options>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, true>; boost::container::map<Key, T, Compare, Allocator, Options>::value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
^~~~~~
include/boost/container/map.hpp:598:13: error: with ‘boost::container::map<Key, T, Compare, Allocator, Options>::iterator boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator, boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type&&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; boost::container::map<Key, T, Compare, Allocator, Options>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, true>; boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’
iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x)
^~~~~~
In file included from include/boost/interprocess/segment_manager.hpp:33:0,
from include/boost/interprocess/detail/managed_memory_impl.hpp:30,
from include/boost/interprocess/managed_shared_memory.hpp:25,
from src/app/SharedOrderBook.h:6,
from src/app/futures_feed.cpp:20:
include/boost/interprocess/detail/named_proxy.hpp: In instantiation of ‘void boost::interprocess::ipcdetail::CtorArgN<T, is_iterator, Args>::construct(void*, boost::interprocess::ipcdetail::false_, const boost::container::container_detail::index_tuple<IdxPack ...>&) [with int ...IdxPack = {0, 1}; T = boost::container::map<const long unsigned int, Order, std::less<const long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >; bool is_iterator = false; Args = {std::less<long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0ul>, 0ul>, boost::interprocess::iset_index> >&}; boost::interprocess::ipcdetail::false_ = boost::interprocess::ipcdetail::bool_<false>]’:
include/boost/interprocess/detail/named_proxy.hpp:71:10: required from ‘void boost::interprocess::ipcdetail::CtorArgN<T, is_iterator, Args>::construct_n(void*, std::size_t, std::size_t&) [with T = boost::container::map<const long unsigned int, Order, std::less<const long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >; bool is_iterator = false; Args = {std::less<long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0ul>, 0ul>, boost::interprocess::iset_index> >&}; std::size_t = long unsigned int]’
src/app/futures_feed.cpp:170:1: required from here
include/boost/interprocess/detail/named_proxy.hpp:83:7: error: no matching function for call to ‘boost::container::map<const long unsigned int, Order, std::less<const long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >::map(std::less<long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >&)’
{ ::new((void*)mem, boost_container_new_t())T(boost::forward<Args>(get<IdxPack>(args_))...); }
If I get rid of the const uint64_t and use uint64_t for the key, I get the error below:
include/boost/container/map.hpp:150:7: error: static assertion failed: (container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value)
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));

Unable to use integer edge weights with Kamada-Kawai layout

The question started here, but after all the updates it is already a different question with a different title.
My Graph type is defined as follows:
using Graph = boost::adjacency_list<vecS, setS, undirectedS, State, CostType>;
where CostType happens to be int.
I am trying to obtain the Kamada-Kawai spring layout as follows:
template <class PointMap>
PointMap layout() const {
PointMap res;
boost::associative_property_map<PointMap> temp(res);
circle_graph_layout(g_, temp, 10.0);
// https://stackoverflow.com/q/33903879/2725810
// https://stackoverflow.com/a/8555715/2725810
typedef std::map<VertexDescriptor, std::size_t> IndexMap;
IndexMap mapIndex;
associative_property_map<IndexMap> propmapIndex(mapIndex);
// http://www.boost.org/doc/libs/1_59_0/libs/graph/doc/bundles.html
kamada_kawai_spring_layout(g_, temp, get(edge_bundle, g_),
square_topology<>(50.0), side_length(50.0),
layout_tolerance<CostType>(),
CostType(1), propmapIndex);
return res;
}
gcc version 4.8.2 complains:
In file included from Graph.h:13:0,
from Astar.h:5,
from Test.cpp:4:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp: In instantiation of ‘bool boost::detail::graph::kamada_kawai_spring_layout_impl<Topology, Graph, PositionMap, WeightMap, EdgeOrSideLength, Done, VertexIndexMap, DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap>::run() [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; EdgeOrSideLength = boost::detail::graph::edge_or_side<false, double>; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; DistanceMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; SpringStrengthMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; PartialDerivativeMap = boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&>]’:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:524:20: required from ‘bool boost::kamada_kawai_spring_layout(const Graph&, PositionMap, WeightMap, const Topology&, boost::detail::graph::edge_or_side<EdgeOrSideLength, T>, Done, typename boost::property_traits<DistanceMap>::value_type, VertexIndexMap, DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap) [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; T = double; bool EdgeOrSideLength = false; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; DistanceMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; SpringStrengthMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; PartialDerivativeMap = boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&>; typename boost::property_traits<DistanceMap>::value_type = int]’
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:559:79: required from ‘bool boost::kamada_kawai_spring_layout(const Graph&, PositionMap, WeightMap, const Topology&, boost::detail::graph::edge_or_side<EdgeOrSideLength, T>, Done, typename boost::property_traits<DistanceMap>::value_type, VertexIndexMap) [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; T = double; bool EdgeOrSideLength = false; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; typename boost::property_traits<DistanceMap>::value_type = int]’
Graph.h:112:61: required from ‘PointMap StateGraph<StateNeighbor>::layout() const [with PointMap = std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > >; StateNeighbor = StateNeighbor<Pancake>]’
Drawer.h:60:75: required from ‘Drawer<Graph>::Drawer(const Graph&) [with Graph = StateGraph<StateNeighbor<Pancake> >]’
Test.cpp:34:22: required from here
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: error: no matching function for call to ‘boost::detail::graph::linear_solver<2ul>::solve(boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::weight_type [2][2], boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::deriv_type&)’
_difference_type delta = -linear_solver<Point::dimensions>::solve(dE_d_d, dE_d);
^
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: note: candidate is:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:95:18: note: template<class Vec> static Vec boost::detail::graph::linear_solver<2ul>::solve(double (*)[2], Vec)
static Vec solve(double mat[2][2], Vec rhs) {
^
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:95:18: note: template argument deduction/substitution failed:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: note: cannot convert ‘dE_d_d’ (type ‘boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::weight_type [2][2] {aka int [2][2]}’) to type ‘double (*)[2]’
_difference_type delta = -linear_solver<Point::dimensions>::solve(dE_d_d, dE_d);
This message is too cryptic for me to understand. It has something to do with not being able to convert int [2][2] to double (*)[2]. Is this related to the fact that CostType is int? But why can't it be? I will very much appreciate help in understanding what I am doing wrong.
Indeed, the error indicates the weights must be doubles.
That's because the algorithm invokes a linear solver with the raw points, and that's failing because the weight type is not a real number type.
If you change
using CostType = double;
everything compiles fine. Live On Coliru
If you insist, you can use a transformation:
#include <boost/property_map/transform_value_property_map.hpp>
kamada_kawai_spring_layout(g_, temp,
boost::make_transform_value_property_map([](int i) -> double { return i; }, get(edge_bundle, g_)),
square_topology<>(50.0),
side_length(50.0),
layout_tolerance<double>(),
double(1),
propmapIndex);
If you don't want to use the lambda, use a functor:
struct to_double { double operator()(int i) const { return i; } };
kamada_kawai_spring_layout(g_, temp,
boost::make_transform_value_property_map(to_double(), get(edge_bundle, g_)),
square_topology<>(50.0),
side_length(50.0),
layout_tolerance<double>(),
double(1),
propmapIndex);

Forming reference to void when getting property map from a bundled property

My Graph type is defined as follows:
using Graph = boost::adjacency_list<vecS, setS, directedS, State, CostType>;
where CostType happens to be int.
I am trying to obtain the Kamada-Kawai spring layout as follows:
template <class PointMap>
PointMap layout() const {
PointMap res;
boost::associative_property_map<PointMap> temp(res);
circle_graph_layout(g_, temp, 10.0);
// http://www.boost.org/doc/libs/1_59_0/libs/graph/doc/bundles.html
bool ok = kamada_kawai_spring_layout(
g_, temp, get(edge_bundle, g_),
square_topology<>(50.0), side_length(50.0));
(void)ok;
//boost::BOOST_CHECK(ok);
return res;
}
The compiler (gcc version 4.8.2) complains about creating a reference to void. I have checked that the circular layout works. What am I doing wrong in the call to kamada_kawai_spring_layout?
Here is a partial output by gcc:
-*- mode: compilation; default-directory: "~/SearchLib/AstarWithPolicies/" -*-
Compilation started at Tue Nov 24 22:54:48
make -k
g++ -Wall -Wextra -Werror -std=c++11 -pedantic -I ~/boost_1_59_0 -I /usr/include/cairomm-1.0/ -I /usr/include/cairo/ -I /usr/include/sigc++-2.0/ -I /usr/lib/x86_64-linux-gnu/sigc++-2.0/include/ -I /usr/include/freetype2/ -o Test Test.cpp -g -lcairo -lX11
In file included from /home/meir/boost_1_59_0/boost/graph/adjacency_list.hpp:246:0,
from Graph.h:10,
from Astar.h:5,
from Test.cpp:4:
/home/meir/boost_1_59_0/boost/graph/detail/adjacency_list.hpp: In instantiation of ‘struct boost::adj_list_any_vertex_pa::bind_<boost::vertex_index_t, boost::adjacency_list<boost::vecS, boost::setS, boost::directedS, Pancake, int, boost::no_property, boost::listS>, Pancake>’:
/home/meir/boost_1_59_0/boost/graph/detail/adjacency_list.hpp:2613:12: required from ‘struct boost::detail::adj_list_choose_vertex_pa<boost::vertex_index_t, boost::adjacency_list<boost::vecS, boost::setS, boost::directedS, Pancake, int, boost::no_property, boost::listS>, Pancake>’
/home/meir/boost_1_59_0/boost/graph/detail/adjacency_list.hpp:2750:12: required from ‘struct boost::adj_list_vertex_property_selector::bind_<boost::adjacency_list<boost::vecS, boost::setS, boost::directedS, Pancake, int, boost::no_property, boost::listS>, Pancake, boost::vertex_index_t>’
/home/meir/boost_1_59_0/boost/graph/properties.hpp:201:12: required from ‘struct boost::detail::vertex_property_map<boost::adjacency_list<boost::vecS, boost::setS, boost::directedS, Pancake, int, boost::no_property, boost::listS>, boost::vertex_index_t>’
/home/meir/boost_1_59_0/boost/graph/properties.hpp:212:10: required from ‘struct boost::property_map<boost::adjacency_list<boost::vecS, boost::setS, boost::directedS, Pancake, int, boost::no_property, boost::listS>, boost::vertex_index_t, void>’
/home/meir/boost_1_59_0/boost/graph/detail/adjacency_list.hpp:1733:5: required by substitution of ‘template<class Config, class Base, class Property> typename boost::property_map<typename Config::graph_type, Property>::const_type boost::get(Property, const boost::adj_list_helper<Config, Base>&) [with Config = boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::setS, boost::directedS, Pancake, int, boost::no_property, boost::listS>, boost::setS, boost::vecS, boost::directedS, Pancake, int, boost::no_property, boost::listS>::config; Base = boost::directed_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::setS, boost::directedS, Pancake, int, boost::no_property, boost::listS>, boost::setS, boost::vecS, boost::directedS, Pancake, int, boost::no_property, boost::listS>::config>; Property = boost::vertex_index_t]’
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:618:58: required from ‘bool boost::kamada_kawai_spring_layout(const Graph&, PositionMap, WeightMap, const Topology&, boost::detail::graph::edge_or_side<EdgeOrSideLength, T>) [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::directedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, int, const int&, void*, const int, boost::edge_bundle_t>; T = double; bool EdgeOrSideLength = false]’
Graph.h:106:55: required from ‘PointMap StateGraph<StateNeighbor>::layout() const [with PointMap = std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > >; StateNeighbor = StateNeighbor<Pancake>]’
Drawer.h:60:75: required from ‘Drawer<Graph>::Drawer(const Graph&) [with Graph = StateGraph<StateNeighbor<Pancake> >]’
Test.cpp:34:22: required from here
/home/meir/boost_1_59_0/boost/graph/detail/adjacency_list.hpp:2543:29: error: forming reference to void
typedef value_type& reference;
UPDATE 1: the same error occurs if I change the graph type to undirectedS.
UPDATE 2: Thanks to the comments, this is the improved version that uses an index map:
template <class PointMap>
PointMap layout() const {
PointMap res;
boost::associative_property_map<PointMap> temp(res);
circle_graph_layout(g_, temp, 10.0);
// https://stackoverflow.com/q/33903879/2725810
// https://stackoverflow.com/a/8555715/2725810
typedef std::map<VertexDescriptor, std::size_t> IndexMap;
IndexMap mapIndex;
associative_property_map<IndexMap> propmapIndex(mapIndex);
// http://www.boost.org/doc/libs/1_59_0/libs/graph/doc/bundles.html
kamada_kawai_spring_layout(g_, temp, get(edge_bundle, g_),
square_topology<>(50.0), side_length(50.0),
layout_tolerance<CostType>(),
CostType(1), propmapIndex);
return res;
}
This still does not satisfy gcc though:
In file included from Graph.h:13:0,
from Astar.h:5,
from Test.cpp:4:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp: In instantiation of ‘bool boost::detail::graph::kamada_kawai_spring_layout_impl<Topology, Graph, PositionMap, WeightMap, EdgeOrSideLength, Done, VertexIndexMap, DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap>::run() [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; EdgeOrSideLength = boost::detail::graph::edge_or_side<false, double>; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; DistanceMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; SpringStrengthMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; PartialDerivativeMap = boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&>]’:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:524:20: required from ‘bool boost::kamada_kawai_spring_layout(const Graph&, PositionMap, WeightMap, const Topology&, boost::detail::graph::edge_or_side<EdgeOrSideLength, T>, Done, typename boost::property_traits<DistanceMap>::value_type, VertexIndexMap, DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap) [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; T = double; bool EdgeOrSideLength = false; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; DistanceMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; SpringStrengthMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; PartialDerivativeMap = boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&>; typename boost::property_traits<DistanceMap>::value_type = int]’
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:559:79: required from ‘bool boost::kamada_kawai_spring_layout(const Graph&, PositionMap, WeightMap, const Topology&, boost::detail::graph::edge_or_side<EdgeOrSideLength, T>, Done, typename boost::property_traits<DistanceMap>::value_type, VertexIndexMap) [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; T = double; bool EdgeOrSideLength = false; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; typename boost::property_traits<DistanceMap>::value_type = int]’
Graph.h:112:61: required from ‘PointMap StateGraph<StateNeighbor>::layout() const [with PointMap = std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > >; StateNeighbor = StateNeighbor<Pancake>]’
Drawer.h:60:75: required from ‘Drawer<Graph>::Drawer(const Graph&) [with Graph = StateGraph<StateNeighbor<Pancake> >]’
Test.cpp:34:22: required from here
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: error: no matching function for call to ‘boost::detail::graph::linear_solver<2ul>::solve(boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::weight_type [2][2], boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::deriv_type&)’
_difference_type delta = -linear_solver<Point::dimensions>::solve(dE_d_d, dE_d);
^
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: note: candidate is:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:95:18: note: template<class Vec> static Vec boost::detail::graph::linear_solver<2ul>::solve(double (*)[2], Vec)
static Vec solve(double mat[2][2], Vec rhs) {
^
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:95:18: note: template argument deduction/substitution failed:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: note: cannot convert ‘dE_d_d’ (type ‘boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::weight_type [2][2] {aka int [2][2]}’) to type ‘double (*)[2]’
_difference_type delta = -linear_solver<Point::dimensions>::solve(dE_d_d, dE_d);
EDIT: Since this has become a different question, I started a new question here.