Dmitry Bufistov wrote:
Geoff Hilton escribió:
Note: graph variable is of type const Graph&.
[skip]
Also, my Weight type has an explicit constructor which takes a POD convertible to 0, a requirement imposed it seems by line 155 of bellman_ford_shortest_paths.hpp. Why doesn't the algorithm take a weight of value zero as a parameter and use it instead?
Anyway, because of this explicit constructor I've added a (typical) assignment operator (not sure if this is relevant, but I'm mentioning it just in case).
I should also note that out of curiosity I commented out line 103 of bellman_ford_shortest_paths.hpp which is:
function_requires
>(); Commenting out the above line allows my code as written above to compile, otherwise it fails with the error written in my original response (quoted above). Whether the compiled code (with line 103 commented out) functions as expected I don't know, I haven't tested it.
Thanks, Geoff
It looks like the problem is with template
struct ReadablePropertyMapConcept; The following code fails to compile:
#include
#include using namespace boost; struct EdgeProp { double weight; };
typedef boost::adjacency_list
graph_t; int main() { typedef boost::property_map ::const_type WeightMap; typedef boost::graph_traits ::edge_descriptor Edge; function_requires >(); } You may try to change the boost/property_map.hpp as follows: (in the version 1.37 the line number is 165) typename typename property_traits<PMap>::value_type val; to the typename remove_const
::type val; Does it work for you?
Regards, Dmitry
Thanks Dmitry, it does work! I do wonder though, isn't there a better fix? What about specializing ReadablePropertyMapConcept specifically for const properties, or does that not make sense with concept classes? I'm okay with modifying BGL code, but the remove_const makes me feel dirty. This sounds like something that should be brought up with BGL maintainers... Geoff