DEAL_II_NAMESPACE_OPEN
-namespace
+namespace internal
{
- // helper struct for is_base_of_all and all_same_as
- template <bool... Types> struct BoolStorage;
+ namespace TemplateConstraints
+ {
+ // helper struct for is_base_of_all and all_same_as
+ template <bool... Values> struct BoolStorage;
+
+
+ /**
+ * A helper class whose `value` member is true or false depending on
+ // whether all of the given boolean template arguments are true.
+ */
+ template <bool... Values>
+ struct all_true
+ {
+ static constexpr bool value =
+ std::is_same<BoolStorage<Values..., true>,
+ BoolStorage<true, Values...>>::value;
+ };
+ }
}
/**
struct is_base_of_all
{
static constexpr bool value =
- std::is_same<BoolStorage<std::is_base_of<Base,Derived>::value..., true>,
- BoolStorage<true, std::is_base_of<Base,Derived>::value...>>::value;
+ internal::TemplateConstraints::all_true<std::is_base_of<Base,Derived>::value...>::value;
};
/**
* 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.
+ * parameter packs and tests if all of the types in the `Types...`
+ * parameter pack are equal to the `Type` given as first template
+ * argument. The result is stored in the member variable value.
*/
template <class Type, class... Types>
struct all_same_as
{
static constexpr bool value =
- std::is_same<BoolStorage<std::is_same<Type, Types>::value..., true>,
- BoolStorage<true, std::is_same<Type, Types>::value...>>::value;
+ internal::TemplateConstraints::all_true<std::is_same<Type, Types>::value...>::value;
};
+/*
+ * A generalization of `std::enable_if` that only works if
+ * <i>all</i> of the given boolean template parameters are
+ * true.
+ */
+template <bool... Values>
+struct enable_if_all : std::enable_if<internal::TemplateConstraints::all_true<Values...>::value>
+{};
+
+
+
template <bool, typename> struct constraint_and_return_value;