From 0424e44d72ae10a9c46ef2617db4b1db538d79b4 Mon Sep 17 00:00:00 2001
From: Peter Munch <peterrmuench@gmail.com>
Date: Sun, 2 Oct 2022 12:39:04 +0200
Subject: [PATCH] Use std::all_of

---
 .../mg_transfer_global_coarsening.templates.h | 28 ++++++++-----------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h
index 6fe22ecdcc..71444b4e54 100644
--- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h
+++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h
@@ -1779,26 +1779,22 @@ namespace internal
       transfer.n_components =
         dof_handler_fine.get_fe_collection().n_components();
 
-      // TODO: replace with std::all_of once FECellection supports range-based
-      // iterations
-      const auto all_of = [](const auto &fe_collection, const auto &fu) {
-        for (unsigned int i = 0; i < fe_collection.size(); ++i)
-          if (fu(fe_collection[i]) == false)
-            return false;
-
-        return true;
-      };
-
       transfer.fine_element_is_continuous =
-        all_of(dof_handler_fine.get_fe_collection(), [](const auto &fe) {
-          return fe.n_dofs_per_cell() == 0 || fe.n_dofs_per_vertex() > 0;
-        });
+        std::all_of(dof_handler_fine.get_fe_collection().begin(),
+                    dof_handler_fine.get_fe_collection().end(),
+                    [](const auto &fe) {
+                      return fe.n_dofs_per_cell() == 0 ||
+                             fe.n_dofs_per_vertex() > 0;
+                    });
 
 #if DEBUG
       const bool fine_element_is_discontinuous =
-        all_of(dof_handler_fine.get_fe_collection(), [](const auto &fe) {
-          return fe.n_dofs_per_cell() == 0 || fe.n_dofs_per_vertex() == 0;
-        });
+        std::all_of(dof_handler_fine.get_fe_collection().begin(),
+                    dof_handler_fine.get_fe_collection().end(),
+                    [](const auto &fe) {
+                      return fe.n_dofs_per_cell() == 0 ||
+                             fe.n_dofs_per_vertex() == 0;
+                    });
 
       Assert(transfer.fine_element_is_continuous !=
                fine_element_is_discontinuous,
-- 
2.39.5