From c2eee3e868bf2b3b7cb6e69f8c2a31fb9ff9a61f Mon Sep 17 00:00:00 2001
From: Daniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Date: Mon, 7 Jan 2019 11:57:39 +0100
Subject: [PATCH] Use range-based for loops in include/grid

---
 include/deal.II/grid/grid_generator.h |  2 +-
 include/deal.II/grid/grid_tools.h     | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/deal.II/grid/grid_generator.h b/include/deal.II/grid/grid_generator.h
index 354037d6f2..76b0f42a3a 100644
--- a/include/deal.II/grid/grid_generator.h
+++ b/include/deal.II/grid/grid_generator.h
@@ -1228,7 +1228,7 @@ namespace GridGenerator
    * auto min_line_length = [](const Triangulation<dim> &tria) -> double
    * {
    *   double length = std::numeric_limits<double>::max();
-   *   for (const auto cell : tria.active_cell_iterators())
+   *   for (const auto &cell : tria.active_cell_iterators())
    *     for (unsigned int n = 0; n < GeometryInfo<dim>::lines_per_cell; ++n)
    *       length = std::min(length, (cell->line(n)->vertex(0) -
    *                                  cell->line(n)->vertex(1)).norm());
diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h
index eeb18420b6..c6642584b5 100644
--- a/include/deal.II/grid/grid_tools.h
+++ b/include/deal.II/grid/grid_tools.h
@@ -3581,9 +3581,9 @@ namespace GridTools
     // archive the cellids in an efficient binary format
     const std::size_t n_cells = cell_ids.size();
     ar &              n_cells;
-    for (auto &it : cell_ids)
+    for (const auto &id : cell_ids)
       {
-        CellId::binary_type binary_cell_id = it.template to_binary<dim>();
+        CellId::binary_type binary_cell_id = id.template to_binary<dim>();
         ar &                binary_cell_id;
       }
 
@@ -3649,7 +3649,7 @@ namespace GridTools
       vertices_with_ghost_neighbors =
         tria->compute_vertices_with_ghost_neighbors();
 
-    for (auto cell : tria->active_cell_iterators())
+    for (const auto &cell : tria->active_cell_iterators())
       if (cell->is_locally_owned())
         {
           std::set<dealii::types::subdomain_id> send_to;
@@ -3686,10 +3686,8 @@ namespace GridTools
                 {
                   const CellId cellid = cell->id();
 
-                  for (auto it : send_to)
+                  for (const auto subdomain : send_to)
                     {
-                      const dealii::types::subdomain_id subdomain = it;
-
                       // find the data buffer for proc "subdomain" if it exists
                       // or create an empty one otherwise
                       typename DestinationToBufferMap::iterator p =
-- 
2.39.5