From: Wolfgang Bangerth Date: Thu, 6 Apr 2023 23:17:50 +0000 (-0600) Subject: Simplify code slightly. X-Git-Tag: v9.5.0-rc1~363^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbafbe59c106729537c42438bf55e945750d7b88;p=dealii.git Simplify code slightly. Avoid using a second counter in a range-based for loop, which always looks a bit awkward. --- diff --git a/source/grid/grid_tools_cache.cc b/source/grid/grid_tools_cache.cc index 4caa9a671a..596959ef69 100644 --- a/source/grid/grid_tools_cache.cc +++ b/source/grid/grid_tools_cache.cc @@ -130,10 +130,10 @@ namespace GridTools std::vector, typename Triangulation::active_cell_iterator>> - boxes(tria->n_active_cells()); - unsigned int i = 0; + boxes; + boxes.reserve(tria->n_active_cells()); for (const auto &cell : tria->active_cell_iterators()) - boxes[i++] = std::make_pair(mapping->get_bounding_box(cell), cell); + boxes.emplace_back(mapping->get_bounding_box(cell), cell); cell_bounding_boxes_rtree = pack_rtree(boxes); update_flags = update_flags & ~update_cell_bounding_boxes_rtree;