From 4d850f67eeb2a66095a291449a9ec93045dc96e1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 3 Jul 2023 09:32:14 -0600 Subject: [PATCH] Use C++17-style fold expressions. --- include/deal.II/base/template_constraints.h | 28 +++------------------ 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index d298064240..5eb2b45d3e 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -165,15 +165,6 @@ namespace internal { namespace TemplateConstraints { - // TODO: Once we are able to use DEAL_II_HAVE_CXX17, the following classes - // can be made much simpler with the help of fold expressions, see - // https://en.cppreference.com/w/cpp/language/fold - - // helper struct for is_base_of_all and all_same_as - template - struct BoolStorage; - - /** * A helper class whose `value` member is true or false depending on * whether all of the given boolean template arguments are `true`. @@ -185,9 +176,7 @@ namespace internal template struct all_true { - static constexpr bool value = - std::is_same, - BoolStorage>::value; + static constexpr bool value = (Values && ...); }; @@ -196,20 +185,9 @@ namespace internal * boolean template arguments are true. */ template - struct any_true; - - - template - struct any_true - { - static constexpr bool value = V1 || any_true::value; - }; - - - template <> - struct any_true<> + struct any_true { - static constexpr bool value = false; + static constexpr bool value = (Values || ...); }; } // namespace TemplateConstraints } // namespace internal -- 2.39.5