From: Daniel Arndt Date: Tue, 30 Jun 2020 17:01:25 +0000 (-0400) Subject: Remove constraint_and_return_value and types_are_equal X-Git-Tag: v9.3.0-rc1~1334^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10636%2Fhead;p=dealii.git Remove constraint_and_return_value and types_are_equal --- diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index 68f12520ba..092d37592a 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -118,91 +118,6 @@ public: -template -struct constraint_and_return_value; - - -/** - * This specialization of the general template for the case of a true - * first template argument declares a local alias type to the - * second template argument. It is used in order to construct constraints on - * template arguments in template (and member template) functions. The - * negative specialization is missing. - * - * Here's how the trick works, called SFINAE (substitution failure is not an - * error): The C++ standard prescribes that a template function is only - * considered in a call, if all parts of its signature can be instantiated - * with the template parameter replaced by the respective types/values in this - * particular call. Example: - * @code - * template - * typename T::type foo(T) - * { - * ... - * }; - * ... - * foo(1); - * @endcode - * The compiler should detect that in this call, the template parameter T must - * be identified with the type "int". However, the return type T::type does - * not exist. The trick now is that this is not considered an error: this - * template is simply not considered, the compiler keeps on looking for - * another possible function foo. - * - * The idea is then to make the return type un-instantiatable if certain - * constraints on the template types are not satisfied: - * @code - * template - * struct constraint_and_return_value; - * - * template - * struct constraint_and_return_value - * { - * using type = T; - * }; - * @endcode - * constraint_and_return_value is not defined. Given something like - * @code - * template - * struct int_or_double - * { - * static const bool value = false; - * }; - * - * template <> - * struct int_or_double - * { - * static const bool value = true; - * }; - * - * template <> - * struct int_or_double - * { - * static const bool value = true; - * }; - * @endcode - * we can write a template - * @code - * template - * typename constraint_and_return_value::value,void>::type - * f (T); - * @endcode - * which can only be instantiated if T=int or T=double. A call to f('c') will - * just fail with a compiler error: "no instance of f(char) found". On the - * other hand, if the predicate in the first argument to the - * constraint_and_return_value template is true, then the return type is just - * the second type in the template. - * - * @deprecated Use std::enable_if instead. - */ -template -struct DEAL_II_DEPRECATED constraint_and_return_value -{ - using type = T; -}; - - - /** * A template class that simply exports its template argument as a local * alias. This class, while at first appearing useless, makes sense in the @@ -314,32 +229,6 @@ struct PointerComparison -/** - * A type that can be used to determine whether two types are equal. It allows - * to write code like - * @code - * template - * void Vector::some_operation () - * { - * if (std::is_same::value == true) - * call_some_blas_function_for_doubles; - * else - * do_it_by_hand; - * } - * @endcode - * - * This construct is made possible through the existence of a partial - * specialization of the class for template arguments that are equal. - * - * @deprecated Use the standard library type trait std::is_same - * instead of this class. - */ -template -struct DEAL_II_DEPRECATED types_are_equal : std::is_same -{}; - - - namespace internal { /**