Skip to content
Snippets Groups Projects
Commit 235f5c2d authored by Oliver Sander's avatar Oliver Sander
Browse files

add enable_if as an stl-conforming replacement of EnableIf. Take it from the...

add enable_if as an stl-conforming replacement of EnableIf.  Take it from the library header if present.  Deprecate EnableIf

[[Imported from SVN: r5396]]
parent a9faf774
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment