From: Wolfgang Bangerth Date: Sat, 25 Feb 2023 21:46:33 +0000 (-0700) Subject: Introduce a concept to check for dimensions. X-Git-Tag: v9.5.0-rc1~513^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a12b99d4d94c106332143f18b0ed7b67c5736440;p=dealii.git Introduce a concept to check for dimensions. --- diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index fd333a27d1..2f03800ee0 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -680,6 +680,29 @@ struct EnableIfScalar> }; +/** + * A namespace that is used to declare concepts used in C++20-style + * `requires` clauses. + */ +namespace concepts +{ +#ifdef DEAL_II_HAVE_CXX20 + /** + * A concept that tests that a combination of `dim` and `spacedim` + * template arguments is valid. Specifically, we must have that + * - `dim>=1` + * - `spacedim<=3` + * - `dim<=spacedim`. + * These are the kinds of requirements that are imposed, for + * example, on class Triangulation. + */ + template + concept is_valid_dim_spacedim = (dim >= 1 && spacedim <= 3 && + dim <= spacedim); +#endif +} // namespace concepts + + DEAL_II_NAMESPACE_CLOSE #endif