diff --git a/dune/solvers/common/algorithm.hh b/dune/solvers/common/algorithm.hh
index 898906baf806424bde50ade7b67805fdaa09f656..eb49bef1e2c363b3bfca049823dcf2626766a9ed 100644
--- a/dune/solvers/common/algorithm.hh
+++ b/dune/solvers/common/algorithm.hh
@@ -363,7 +363,34 @@ constexpr void ifElse(const Condition& condition, IfFunc&& ifFunc)
 
 
 
+namespace Imp {
+
+  template<class T1, class T2>
+  constexpr auto equals(T1&& t1, T2&& t2, PriorityTag<1>) -> decltype(T1::value, T2::value, std::integral_constant<bool,T1::value == T2::value>())
+  { return {}; }
+
+  template<class T1, class T2>
+  constexpr auto equals(T1&& t1, T2&& t2, PriorityTag<0>)
+  {
+    return t1==t2;
+  }
+
+} // namespace Imp
+
+
 
+/**
+ * \brief Equality comparison
+ *
+ * If both types have a static member value, the result of comparing
+ * these is returned as std::integral_constant<bool, *>. Otherwise
+ * the result of a runtime comparison of t1 and t2 is directly returned.
+ */
+template<class T1, class T2>
+constexpr auto equals(T1&& t1,  T2&& t2)
+{
+  return Hybrid::Imp::equals(std::forward<T1>(t1), std::forward<T2>(t2), PriorityTag<1>());
+}