From 41e64b12a92cfb24695e55297d1a97e24bbb21bb Mon Sep 17 00:00:00 2001 From: Andrea Cassioli Date: Thu, 18 Jun 2026 22:33:15 +0200 Subject: [PATCH 1/2] add missing const values; use some using instead of typedef --- ...sive_shortest_path_nonnegative_weights.hpp | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/include/boost/graph/successive_shortest_path_nonnegative_weights.hpp b/include/boost/graph/successive_shortest_path_nonnegative_weights.hpp index 8e1f5ad94..9701ee151 100644 --- a/include/boost/graph/successive_shortest_path_nonnegative_weights.hpp +++ b/include/boost/graph/successive_shortest_path_nonnegative_weights.hpp @@ -14,8 +14,6 @@ #ifndef BOOST_GRAPH_SUCCESSIVE_SHORTEST_PATH_HPP #define BOOST_GRAPH_SUCCESSIVE_SHORTEST_PATH_HPP -#include - #include #include #include @@ -36,13 +34,14 @@ namespace detail : public put_get_helper< typename property_traits< Weight >::value_type, MapReducedWeight< Graph, Weight, Distance, Reversed > > { - typedef graph_traits< Graph > gtraits; + using g_traits = graph_traits< Graph >; public: - typedef boost::readable_property_map_tag category; - typedef typename property_traits< Weight >::value_type value_type; - typedef value_type reference; - typedef typename gtraits::edge_descriptor key_type; + using category = boost::readable_property_map_tag; + using value_type = typename property_traits< Weight >::value_type; + using reference = value_type; + using key_type = typename g_traits::edge_descriptor; + MapReducedWeight(const Graph& g, Weight w, Distance d, Reversed r) : g_(g), weight_(w), distance_(d), rev_(r) { @@ -56,9 +55,9 @@ namespace detail private: const Graph& g_; - Weight weight_; - Distance distance_; - Reversed rev_; + const Weight weight_; + const Distance distance_; + const Reversed rev_; }; template < class Graph, class Weight, class Distance, class Reversed > @@ -137,13 +136,13 @@ namespace detail template < class Graph, class Capacity, class ResidualCapacity, class Weight, class Reversed, class Pred, class Distance, class VertexIndex > - void successive_shortest_path_nonnegative_weights_dispatch3(Graph& g, + void successive_shortest_path_nonnegative_weights_dispatch3(const Graph& g, typename graph_traits< Graph >::vertex_descriptor s, typename graph_traits< Graph >::vertex_descriptor t, Capacity capacity, ResidualCapacity residual_capacity, Weight weight, Reversed rev, VertexIndex index, Pred pred, Distance dist, param_not_found) { - typedef typename property_traits< Weight >::value_type D; + using D = typename property_traits< Weight >::value_type; std::vector< D > d_map(num_vertices(g)); @@ -155,7 +154,7 @@ namespace detail template < class Graph, class P, class T, class R, class Capacity, class ResidualCapacity, class Weight, class Reversed, class Pred, class Distance, class VertexIndex > - void successive_shortest_path_nonnegative_weights_dispatch2(Graph& g, + void successive_shortest_path_nonnegative_weights_dispatch2(const Graph& g, typename graph_traits< Graph >::vertex_descriptor s, typename graph_traits< Graph >::vertex_descriptor t, Capacity capacity, ResidualCapacity residual_capacity, Weight weight, Reversed rev, @@ -171,14 +170,14 @@ namespace detail template < class Graph, class P, class T, class R, class Capacity, class ResidualCapacity, class Weight, class Reversed, class Pred, class VertexIndex > - void successive_shortest_path_nonnegative_weights_dispatch2(Graph& g, + void successive_shortest_path_nonnegative_weights_dispatch2(const Graph& g, typename graph_traits< Graph >::vertex_descriptor s, typename graph_traits< Graph >::vertex_descriptor t, Capacity capacity, ResidualCapacity residual_capacity, Weight weight, Reversed rev, VertexIndex index, Pred pred, param_not_found, const bgl_named_params< P, T, R >& params) { - typedef typename property_traits< Weight >::value_type D; + using D = typename property_traits< Weight >::value_type; std::vector< D > d_map(num_vertices(g)); @@ -191,7 +190,7 @@ namespace detail template < class Graph, class P, class T, class R, class Capacity, class ResidualCapacity, class Weight, class Reversed, class Pred, class VertexIndex > - void successive_shortest_path_nonnegative_weights_dispatch1(Graph& g, + void successive_shortest_path_nonnegative_weights_dispatch1(const Graph& g, typename graph_traits< Graph >::vertex_descriptor s, typename graph_traits< Graph >::vertex_descriptor t, Capacity capacity, ResidualCapacity residual_capacity, Weight weight, Reversed rev, @@ -206,14 +205,14 @@ namespace detail template < class Graph, class P, class T, class R, class Capacity, class ResidualCapacity, class Weight, class Reversed, class VertexIndex > - void successive_shortest_path_nonnegative_weights_dispatch1(Graph& g, + void successive_shortest_path_nonnegative_weights_dispatch1(const Graph& g, typename graph_traits< Graph >::vertex_descriptor s, typename graph_traits< Graph >::vertex_descriptor t, Capacity capacity, ResidualCapacity residual_capacity, Weight weight, Reversed rev, VertexIndex index, param_not_found, const bgl_named_params< P, T, R >& params) { - typedef typename graph_traits< Graph >::edge_descriptor edge_descriptor; + using edge_descriptor = typename graph_traits< Graph >::edge_descriptor; std::vector< edge_descriptor > pred_vec(num_vertices(g)); successive_shortest_path_nonnegative_weights_dispatch2(g, s, t, @@ -247,7 +246,7 @@ void successive_shortest_path_nonnegative_weights(Graph& g, typename graph_traits< Graph >::vertex_descriptor s, typename graph_traits< Graph >::vertex_descriptor t) { - bgl_named_params< int, buffer_param_t > params(0); + const bgl_named_params< int, buffer_param_t > params(0); successive_shortest_path_nonnegative_weights(g, s, t, params); } From cf1839a3dceb3c54aad1e63119e94a29999d5d72 Mon Sep 17 00:00:00 2001 From: Andrea Cassioli Date: Fri, 19 Jun 2026 22:02:06 +0200 Subject: [PATCH 2/2] aPR comments --- ...ssive_shortest_path_nonnegative_weights.hpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/include/boost/graph/successive_shortest_path_nonnegative_weights.hpp b/include/boost/graph/successive_shortest_path_nonnegative_weights.hpp index 9701ee151..b3bb153bf 100644 --- a/include/boost/graph/successive_shortest_path_nonnegative_weights.hpp +++ b/include/boost/graph/successive_shortest_path_nonnegative_weights.hpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace boost { @@ -34,6 +35,13 @@ namespace detail : public put_get_helper< typename property_traits< Weight >::value_type, MapReducedWeight< Graph, Weight, Distance, Reversed > > { + + using edge_descriptor = typename graph_traits< Graph >::edge_descriptor; + using vertex_descriptor = typename graph_traits< Graph >::vertex_descriptor; + + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept )); + using g_traits = graph_traits< Graph >; public: @@ -55,9 +63,9 @@ namespace detail private: const Graph& g_; - const Weight weight_; - const Distance distance_; - const Reversed rev_; + Weight weight_; + Distance distance_; + Reversed rev_; }; template < class Graph, class Weight, class Distance, class Reversed > @@ -79,9 +87,11 @@ void successive_shortest_path_nonnegative_weights(const Graph& g, ResidualCapacity residual_capacity, Weight weight, Reversed rev, VertexIndex index, Pred pred, Distance distance, Distance2 distance_prev) { + + using edge_descriptor = typename graph_traits< Graph >::edge_descriptor; + filtered_graph< const Graph, is_residual_edge< ResidualCapacity > > gres = detail::residual_graph(g, residual_capacity); - typedef typename graph_traits< Graph >::edge_descriptor edge_descriptor; BGL_FORALL_EDGES_T(e, g, Graph) {