From 235f5c2d425bea37447bb87182089dbf5775c82e Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@dune-project.org>
Date: Mon, 22 Dec 2008 14:11:22 +0000
Subject: [PATCH] add enable_if as an stl-conforming replacement of EnableIf. 
 Take it from the library header if present.  Deprecate EnableIf

[[Imported from SVN: r5396]]
---
 common/typetraits.hh | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/common/typetraits.hh b/common/typetraits.hh
index bfd220728..7ad8498b1 100644
--- a/common/typetraits.hh
+++ b/common/typetraits.hh
@@ -9,6 +9,8 @@
 #include <type_traits>
 #endif
 
+#include <dune/common/deprecated.hh>
+
 namespace Dune
 {
 
@@ -257,17 +259,39 @@ namespace Dune
    * @brief Enable typedef if condition is met.
    *
    * Depending on the value of b the type T is provided as typedef type.
+   * \deprecated Use enable_if instead
    */
   template<bool b, typename T=void>
   struct EnableIf
   {
     typedef T type;
     typedef T Type;
-  };
+  } DUNE_DEPRECATED;
 
   template<typename T>
   struct EnableIf<false,T>
+  {} DUNE_DEPRECATED;
+
+#ifdef HAVE_TYPE_TRAITS
+  using std::enable_if;
+#else
+  /**
+   * @brief Enable typedef if condition is met.
+   *
+   * Replacement implementation for compilers without this in the stl.
+   * Depending on the value of b the type T is provided as typedef type.
+   */
+  template<bool b, typename T=void>
+  struct enable_if
+  {
+    typedef T type;
+  };
+
+  template<typename T>
+  struct enable_if<false,T>
   {};
+#endif
+
 
   /**
    * @brief Enable typedef if two types are interoperable.
-- 
GitLab