From cc37808b465d433badf25e96da8007b149c71ce7 Mon Sep 17 00:00:00 2001
From: Max Kahnt <max.kahnt@fu-berlin.de>
Date: Thu, 28 Sep 2017 15:31:53 +0200
Subject: [PATCH] Cleanup types, namespace and documentation.

---
 dune/matrix-vector/algorithm.hh | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/dune/matrix-vector/algorithm.hh b/dune/matrix-vector/algorithm.hh
index e17bc07..526b542 100644
--- a/dune/matrix-vector/algorithm.hh
+++ b/dune/matrix-vector/algorithm.hh
@@ -7,27 +7,27 @@
 
 #include <dune/common/hybridutilities.hh>
 #include <dune/common/typetraits.hh>
+#include <dune/common/std/type_traits.hh>
 
 namespace Dune {
 namespace MatrixVector {
 
-/**
- * \brief Hybrid for loop over sparse range
- */
-template <class Range, class F,
-          std::enable_if_t<Dune::IsTupleOrDerived<std::decay_t<Range>>::value, int> = 0>
+template<class T>
+constexpr auto isTupleOrDerived() {
+  return Std::bool_constant<IsTupleOrDerived<std::decay_t<T>>::value>();
+}
+
+//! \brief Hybrid for loop over sparse range (static/tuple-like candidate)
+template <class Range, class F, std::enable_if_t<isTupleOrDerived<Range>(), int> = 0>
 void sparseRangeFor(Range&& range, F&& f) {
   using namespace Dune::Hybrid;
-  forEach(integralRange(Dune::Hybrid::size(range)), [&](auto&& i) {
+  forEach(integralRange(size(range)), [&](auto&& i) {
       f(range[i], i);
   });
 }
 
-/**
- * \brief Hybrid for loop over sparse range
- */
-template<class Range, class F,
-          std::enable_if_t<not Dune::IsTupleOrDerived<std::decay_t<Range>>::value, int> = 0>
+//! \brief Hybrid for loop over sparse range (dynamic/sparse candidate)
+template<class Range, class F, std::enable_if_t<not isTupleOrDerived<Range>(), int> = 0>
 void sparseRangeFor(Range&& range, F&& f)
 {
   auto it = range.begin();
-- 
GitLab