File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 99
1010#include < algorithm>
1111#include < cstddef>
12+ #include < ranges>
1213
1314void t_rr_graph_storage::reserve_edges (size_t num_edges) {
1415 edge_src_node_.reserve (num_edges);
@@ -67,14 +68,16 @@ void t_rr_graph_storage::remove_edges(std::vector<RREdgeId>& rr_edges_to_remove)
6768 // Sort and make sure all edge indices are unique
6869 vtr::uniquify (rr_edges_to_remove);
6970 VTR_ASSERT_SAFE (std::is_sorted (rr_edges_to_remove.begin (), rr_edges_to_remove.end ()));
71+
72+ // Make sure the edge indices are valid
73+ VTR_ASSERT (static_cast <size_t >(rr_edges_to_remove.back ()) <= edge_dest_node_.size ());
7074
7175 // Index of the last edge
7276 size_t edge_list_end = edge_dest_node_.size () - 1 ;
7377
7478 // Iterate backwards through the list of indices we want to remove.
75- for (auto it = rr_edges_to_remove.rbegin (); it != rr_edges_to_remove.rend (); ++it) {
76- RREdgeId erase_idx = *it;
77-
79+
80+ for (RREdgeId erase_idx : std::ranges::reverse_view (rr_edges_to_remove)) {
7881 // Copy what's at the end of the list to the index we wanted to remove
7982 edge_dest_node_[erase_idx] = edge_dest_node_[RREdgeId (edge_list_end)];
8083 edge_src_node_[erase_idx] = edge_src_node_[RREdgeId (edge_list_end)];
You can’t perform that action at this time.
0 commit comments