From: Wolfgang Bangerth Date: Mon, 3 Jul 2023 15:32:14 +0000 (-0600) Subject: Use C++17-style fold expressions. X-Git-Tag: relicensing~769^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d850f67eeb2a66095a291449a9ec93045dc96e1;p=dealii.git Use C++17-style fold expressions. --- 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