From 0e352c93bd165f167173110647eb24c792588c60 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 5 Sep 2017 01:25:13 +0200 Subject: [PATCH] Introduce a all_same_as type trait structs --- include/deal.II/base/template_constraints.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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; -- 2.39.5