From 4bc4276cd63ce95a404df73af3747479884ba044 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org>
Date: Mon, 12 Dec 2022 17:10:19 +0100
Subject: [PATCH] Specialize std::tuple_size for MultiTypeBlock*

... because we also specialize `std::tuple_element` and
it derives from `std::tuple` after all.
---
 dune/istl/multitypeblockmatrix.hh | 9 +++++++++
 dune/istl/multitypeblockvector.hh | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/dune/istl/multitypeblockmatrix.hh b/dune/istl/multitypeblockmatrix.hh
index 57f73b2c7..e15ab1470 100644
--- a/dune/istl/multitypeblockmatrix.hh
+++ b/dune/istl/multitypeblockmatrix.hh
@@ -613,5 +613,14 @@ namespace std
   {
     using type = typename std::tuple_element<i, std::tuple<Args...> >::type;
   };
+
+  /** \brief Make std::tuple_size work for MultiTypeBlockMatrix
+   *
+   * It derives from std::tuple after all.
+   */
+  template <typename... Args>
+  struct tuple_size<Dune::MultiTypeBlockMatrix<Args...> >
+    : std::integral_constant<std::size_t, sizeof...(Args)>
+  {};
 }
 #endif
diff --git a/dune/istl/multitypeblockvector.hh b/dune/istl/multitypeblockvector.hh
index 5f1a3b24e..e512fcb3f 100644
--- a/dune/istl/multitypeblockvector.hh
+++ b/dune/istl/multitypeblockvector.hh
@@ -345,6 +345,15 @@ namespace std
   {
     using type = typename std::tuple_element<i, std::tuple<Args...> >::type;
   };
+
+  /** \brief Make std::tuple_size work for MultiTypeBlockVector
+   *
+   * It derives from std::tuple after all.
+   */
+  template <typename... Args>
+  struct tuple_size<Dune::MultiTypeBlockVector<Args...> >
+    : std::integral_constant<std::size_t, sizeof...(Args)>
+  {};
 }
 
 #endif
-- 
GitLab