From: Matthias Maier Date: Thu, 6 Apr 2017 16:28:16 +0000 (-0500) Subject: CXX11 cleanup: Remove C++03 implementation from template_constraints.h X-Git-Tag: v9.0.0-rc1~1726^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3c4c536089e640d1e9274d12836f99518321321;p=dealii.git CXX11 cleanup: Remove C++03 implementation from template_constraints.h --- diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index bc44e7105e..7075c9f1c1 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -174,7 +174,11 @@ struct PointerComparison * two pointers are equal. */ template - static bool equal (const T *p1, const T *p2); + static bool equal (const T *p1, const T *p2) + { + return (p1==p2); + } + /** * Comparison function for pointers of different types. The C++ language @@ -183,7 +187,11 @@ struct PointerComparison * can't be the same, so we always return @p false. */ template - static bool equal (const T *, const U *); + static bool equal (const T *, const U *) + { + return false; + } + }; @@ -300,7 +308,6 @@ struct types_are_equal }; - /** * A class with a local typedef that represents the type that results from the * product of two variables of type @p T and @p U. In other words, we would @@ -352,117 +359,9 @@ struct types_are_equal template struct ProductType { -#ifdef DEAL_II_WITH_CXX11 typedef decltype(std::declval() * std::declval()) type; -#endif -}; - -#ifndef DEAL_II_WITH_CXX11 - -template -struct ProductType -{ - typedef T type; -}; - -template -struct ProductType -{ - typedef T type; -}; - -template -struct ProductType -{ - typedef T type; -}; - -template <> -struct ProductType -{ - typedef double type; -}; - -template <> -struct ProductType -{ - typedef double type; -}; - -template <> -struct ProductType -{ - typedef double type; }; -template <> -struct ProductType -{ - typedef double type; -}; - -template <> -struct ProductType -{ - typedef long double type; -}; - -template <> -struct ProductType -{ - typedef long double type; -}; - -template <> -struct ProductType -{ - typedef double type; -}; - -template <> -struct ProductType -{ - typedef double type; -}; - -template <> -struct ProductType -{ - typedef float type; -}; - -template <> -struct ProductType -{ - typedef float type; -}; - -template <> -struct ProductType -{ - typedef double type; -}; - -template <> -struct ProductType -{ - typedef double type; -}; - -template <> -struct ProductType -{ - typedef float type; -}; - -template <> -struct ProductType -{ - typedef float type; -}; - -#endif - // Annoyingly, there is no std::complex::operator*(U) for scalars U // other than T (not even in C++11, or C++14). We provide our own overloads // in base/complex_overloads.h, but in order for them to work, we have to @@ -492,7 +391,6 @@ struct ProductType,double> typedef std::complex::type> type; }; - template struct ProductType > { @@ -556,7 +454,7 @@ struct ProductType,float> * multiply for different types of arguments, without resulting in ambiguous * call errors by the compiler. * - * @author Wolfgang Bangerth, 2015 + * @author Wolfgang Bangerth, Matthias Maier, 2015 - 2017 */ template struct EnableIfScalar; @@ -567,60 +465,32 @@ template <> struct EnableIfScalar typedef double type; }; - template <> struct EnableIfScalar { typedef float type; }; - template <> struct EnableIfScalar { typedef long double type; }; - template <> struct EnableIfScalar { typedef int type; }; - template <> struct EnableIfScalar { typedef unsigned int type; }; - - template struct EnableIfScalar > { typedef std::complex type; }; -// --------------- inline functions ----------------- - - -template -inline -bool -PointerComparison::equal (const T *, const U *) -{ - return false; -} - - - -template -inline -bool -PointerComparison::equal (const T *p1, const T *p2) -{ - return (p1==p2); -} - - DEAL_II_NAMESPACE_CLOSE #endif