From: Wolfgang Bangerth Date: Sat, 25 Feb 2023 21:46:04 +0000 (-0700) Subject: Introduce a macro to use for 'requires' clauses. X-Git-Tag: v9.5.0-rc1~513^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7893c94803ea7be87f0a2a9b14a32d24ba606148;p=dealii.git Introduce a macro to use for 'requires' clauses. --- diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index b2b830344d..6cf17cf239 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -150,6 +150,18 @@ #cmakedefine DEAL_II_HAVE_CXX17 #cmakedefine DEAL_II_HAVE_CXX20 +/** + * If we have C++20 available, we can have concepts and requires + * clauses. We want to avoid using too many `#ifdef` statements, so + * define a convenience macro that allows us to write a 'requires' + * clause that is simply removed when not using C++20. + */ +#ifdef DEAL_II_HAVE_CXX20 +# define DEAL_II_CXX20_REQUIRES(condition) requires(condition) +#else +# define DEAL_II_CXX20_REQUIRES(condition) +#endif + #cmakedefine DEAL_II_HAVE_FP_EXCEPTIONS #cmakedefine DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS #cmakedefine DEAL_II_HAVE_CXX17_BESSEL_FUNCTIONS @@ -174,9 +186,10 @@ #cmakedefine DEAL_II_FALLTHROUGH @DEAL_II_FALLTHROUGH@ #cmakedefine DEAL_II_CONSTEXPR @DEAL_II_CONSTEXPR@ -// defined for backwards compatibility with older deal.II versions +// The following two are defined for backwards compatibility with older deal.II versions: #define DEAL_II_WITH_CXX11 #define DEAL_II_WITH_CXX14 + #ifdef DEAL_II_HAVE_CXX17 # define DEAL_II_WITH_CXX17 #endif