From: Daniel Arndt Date: Mon, 4 Sep 2017 23:25:13 +0000 (+0200) Subject: Introduce a all_same_as type trait structs X-Git-Tag: v9.0.0-rc1~1079^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e352c93bd165f167173110647eb24c792588c60;p=dealii.git Introduce a all_same_as type trait structs --- diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index 5f2a01149d..fd28c0c3b9 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -27,7 +27,7 @@ DEAL_II_NAMESPACE_OPEN namespace { - // helper struct for is_base_of_all + // helper struct for is_base_of_all and all_same_as template struct BoolStorage; } @@ -47,6 +47,21 @@ struct is_base_of_all +/** + * This struct is a generalization of std::is_same to template + * parameter packs and tests if all of the Types... classes are + * in Type classes. The result is stored in the member variable value. + */ +template +struct all_same_as +{ + static constexpr bool value = + std::is_same::value..., true>, + BoolStorage::value...>>::value; +}; + + + template struct constraint_and_return_value;