]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce a macro to use for 'requires' clauses.
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 25 Feb 2023 21:46:04 +0000 (14:46 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 2 Mar 2023 10:26:27 +0000 (03:26 -0700)
include/deal.II/base/config.h.in

index b2b830344d35c71e101ce1862eec47b98e01467c..6cf17cf239e8a91401708b77f62c9efa62b5f24b 100644 (file)
 #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
 #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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.