]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: Support complex_overloads.h also in C++11 mode 1600/head
authorMatthias Maier <tamiko@43-1.org>
Mon, 14 Sep 2015 07:34:03 +0000 (02:34 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 14 Sep 2015 07:34:03 +0000 (02:34 -0500)
[Wow. This is the first time that I broke something in C++11 mode - I
didn't realize that I was still in C++98 mode when testing...]

Manually specify all products that shall be available in ProductType -
otherwise our overloads cannot be used.

include/deal.II/base/template_constraints.h

index acdc8d3066cefecb3f38d15ce15c3d91809024cf..bc44e7105ea85a5ec1325b3984e7b359756b8e62 100644 (file)
@@ -461,6 +461,13 @@ struct ProductType<unsigned int,float>
   typedef float type;
 };
 
+#endif
+
+// Annoyingly, there is no std::complex<T>::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
+// manually specify all products we want to allow:
+
 template <typename T>
 struct ProductType<std::complex<T>,std::complex<T> >
 {
@@ -498,7 +505,6 @@ struct ProductType<std::complex<T>,float>
   typedef std::complex<typename ProductType<T,float>::type> type;
 };
 
-#endif
 
 
 /**

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.