Index: dijkstra_shortest_paths.hpp =================================================================== --- dijkstra_shortest_paths.hpp (revision 72793) +++ dijkstra_shortest_paths.hpp (working copy) @@ -420,6 +420,9 @@ dummy_property_map p_map; typedef typename property_traits::value_type D; + D inf = choose_param(get_param(params, distance_inf_t()), + (std::numeric_limits::max)()); + dijkstra_shortest_paths (g, s, choose_param(get_param(params, vertex_predecessor), p_map), @@ -427,9 +430,8 @@ choose_param(get_param(params, distance_compare_t()), std::less()), choose_param(get_param(params, distance_combine_t()), - closed_plus()), - choose_param(get_param(params, distance_inf_t()), - (std::numeric_limits::max)()), + closed_plus(inf)), + inf, choose_param(get_param(params, distance_zero_t()), D()), choose_param(get_param(params, graph_visitor), Index: relax.hpp =================================================================== --- relax.hpp (revision 72793) +++ relax.hpp (working copy) @@ -22,9 +22,13 @@ template struct closed_plus { + const T inf; + + closed_plus() : inf(std::numeric_limits::max()) { } + closed_plus(T inf) : inf(inf) { } + T operator()(const T& a, const T& b) const { using namespace std; - const T inf = (std::numeric_limits::max)(); if (a == inf) return inf; if (b == inf) return inf; return a + b;