Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Bundled properties and property maps
From: Geoff Hilton (geoff.hilton_at_[hidden])
Date: 2008-12-16 20:38:37


Alex Brooks wrote:
>> Gotta a const Graph also:
>>
>> property_map<const Graph, double const EdgeProp::*>
>
> This line compiles now, but I get a new compile error from the astar_search
> line. The important bits are:
>
> typedef boost::property_map<const Graph, double const EdgeProp::*>::type
> EdgeWeightMap;
> EdgeWeightMap edgeWeightMap = get(&EdgeProp::cost, graph);
>
> std::vector<VertexRef> predecessors(num_vertices(graph));
> astar_search( graph,
> start,
> aStarHeuristic,
> boost::weight_map(edgeWeightMap).
> predecessor_map(&predecessors[0]).
> visitor(aStarVisitor) );
>
> The error is:
>
> /usr/include/c++/4.3/bits/allocator.h:84: instantiated
> from 'std::allocator<const double>'
> /usr/include/c++/4.3/bits/stl_vector.h:75: instantiated
> from 'std::_Vector_base<const double, std::allocator<const double> >'
> /usr/include/c++/4.3/bits/stl_vector.h:176: instantiated
> from 'std::vector<const double, std::allocator<const double> >'
> /usr/include/boost/graph/astar_search.hpp:360: instantiated from 'void
> boost::detail::astar_dispatch1(VertexListGraph&, typename
> boost::graph_traits<G>::vertex_descriptor, AStarHeuristic, CostMap,
> DistanceMap, WeightMap, IndexMap, ColorMap, const Params&) [with
> VertexListGraph = const boost::adjacency_list<boost::vecS, boost::vecS,
> boost::undirectedS, Point*, EdgeProp, boost::no_property, boost::listS>,
> AStarHeuristic = AStarHeuristic, CostMap =
> boost::detail::error_property_not_found, DistanceMap =
> boost::detail::error_property_not_found, WeightMap =
> boost::bundle_property_map<const boost::adjacency_list<boost::vecS,
> boost::vecS, boost::undirectedS, Point*, EdgeProp, boost::no_property,
> boost::listS>, boost::detail::edge_desc_impl<boost::undirected_tag, unsigned
> int>, EdgeProp, const double>, IndexMap =
> boost::vec_adj_list_vertex_id_map<boost::property<boost::vertex_bundle_t,
> Point*, boost::no_property>, unsigned int>, ColorMap =
> boost::detail::error_property_not_found, Params =
> boost::bgl_named_params<AStarVisitor, boost::graph_visitor_t,
> boost::bgl_named_params<unsigned int*, boost::vertex_predecessor_t,
> boost::bgl_named_params<boost::bundle_property_map<const
> boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, Point*,
> EdgeProp, boost::no_property, boost::listS>,
> boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, EdgeProp,
> const double>, boost::edge_weight_t, boost::no_property> > >]'
> /usr/include/boost/graph/astar_search.hpp:394: instantiated from 'void
> boost::astar_search(VertexListGraph&, typename
> boost::graph_traits<G>::vertex_descriptor, AStarHeuristic, const
> boost::bgl_named_params<P, T, R>&) [with VertexListGraph = const
> boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, Point*,
> EdgeProp, boost::no_property, boost::listS>, AStarHeuristic = AStarHeuristic,
> P = AStarVisitor, T = boost::graph_visitor_t, R =
> boost::bgl_named_params<unsigned int*, boost::vertex_predecessor_t,
> boost::bgl_named_params<boost::bundle_property_map<const
> boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, Point*,
> EdgeProp, boost::no_property, boost::listS>,
> boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, EdgeProp,
> const double>, boost::edge_weight_t, boost::no_property> >]'
> /home/a.brooks/shh/src/libs/prm/test/stupid.cpp:83: instantiated from here
> /usr/include/c++/4.3/ext/new_allocator.h:82: error: 'const _Tp*
> __gnu_cxx::new_allocator<_Tp>::address(const _Tp&) const [with _Tp = const
> double]' cannot be overloaded
> /usr/include/c++/4.3/ext/new_allocator.h:79: error: with '_Tp*
> __gnu_cxx::new_allocator<_Tp>::address(_Tp&) const [with _Tp = const double]'
>
>
> Any other ideas?
>
>
> Thanks again,
>
> Alex

I'm having the same problem though mine (with MSVC9) says:

error C2678: binary '=': no operator found which takes a left-hand
operand of type 'const Weight' (or there is no acceptable conversion)
c:\program files\boost\boost_1_37_0\boost\property_map.hpp 161

A follow-up would be greatly appreciated.

Thanks,
Geoff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net