From fbc8be302533f5ec1486bd53c4710f3d7cdae097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org> Date: Wed, 16 Mar 2016 14:28:50 +0100 Subject: [PATCH] Use type traits from dune-common --- dune/solvers/common/algorithm.hh | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/dune/solvers/common/algorithm.hh b/dune/solvers/common/algorithm.hh index f9772781..4d20b2f5 100644 --- a/dune/solvers/common/algorithm.hh +++ b/dune/solvers/common/algorithm.hh @@ -5,6 +5,8 @@ #include <dune/common/typeutilities.hh> +#include <dune/common/typetraits.hh> + #include <dune/istl/multitypeblockvector.hh> @@ -34,24 +36,6 @@ struct StaticForLoop<ST, end, end> {} }; -// Check if T is an integral constant -template<class T> -struct IsIntegralConstantHelper -{ - static const bool value = false; -}; - -template<class T, T t> -struct IsIntegralConstantHelper<std::integral_constant<T, t>> -{ - static const bool value = true; -}; - -// Check if T is an integral constant -template<class T> -struct IsIntegralConstant : public IsIntegralConstantHelper<std::decay_t<T>> -{}; - // Compute t1==t2 either statically or dynamically @@ -105,7 +89,7 @@ void staticIf(IfFunc&& ifFunc, ElseFunc&& elseFunc, std::true_type) * is the static index. */ template<class Index, class Begin, class End, class F, class... Args, - std::enable_if_t<Imp::IsIntegralConstant<Begin>::value and Imp::IsIntegralConstant<End>::value, int> = 0> + std::enable_if_t<IsIntegralConstant<Begin>::value and IsIntegralConstant<End>::value, int> = 0> void integralRangeFor(Begin&& begin, End&& end, F&& f, Args&&... args) { static const Index begin_t = begin; @@ -136,7 +120,7 @@ void integralRangeFor(Begin&& begin, End&& end, F&& f, Args&&... args) * body is called with indices of type Index. */ template<class Index, class Begin, class End, class F, class... Args, - std::enable_if_t<not(Imp::IsIntegralConstant<Begin>::value and Imp::IsIntegralConstant<End>::value), int> = 0> + std::enable_if_t<not(IsIntegralConstant<Begin>::value and IsIntegralConstant<End>::value), int> = 0> void integralRangeFor(Begin&& begin, End&& end, F&& f, Args&&... args) { for(Index i=begin; i != end; ++i) -- GitLab