]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a conversion constructor to the Vector class and disable it immediately again...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 22 Mar 1999 15:53:54 +0000 (15:53 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 22 Mar 1999 15:53:54 +0000 (15:53 +0000)
git-svn-id: https://svn.dealii.org/trunk@1033 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/vector.h
deal.II/lac/include/lac/vector.templates.h
deal.II/lac/source/vector.cc

index 65b5ece2a50b9bcb46c17a62785bec5502634e1f..50e2e21ea0a51eae655d10b9fc5437bff13321f9 100644 (file)
@@ -92,6 +92,24 @@ class Vector {
                                      *                     all components are copied from V
                                      */
     Vector (const Vector<Number>& V);
+
+
+// note: I disabled this function for the time being, since egcs1.1.2
+// does not respect the "explicit" keyword for template constructors.
+// this leads to unwanted conversions and in some places to automatically
+// generated temporaries, where this is not a good idea    
+//                                  /**
+//                                   * Copy constructor taking a vector of
+//                                   * another data type. This will fail if
+//                                   * there is no conversion path from
+//                                   * #OtherNumber# to #Number#. Note that
+//                                   * you may lose accuracy when copying
+//                                   * to a vector with data elements with
+//                                   * less accuracy.
+//                                   */
+//     template <typename OtherNumber>
+//     explicit
+//     Vector (const Vector<OtherNumber> &v);
     
                                     /**
                                      * Constructor. Set dimension to #n# and
index 7a8205afb894815074eb2814b0c5e4126fc17602..d5d6f360f4bcfd7e4ead1b5972972264dc89c7d1 100644 (file)
@@ -53,6 +53,25 @@ Vector<Number>::Vector (const Vector<Number>& v) :
 
 
 
+// see the .h file for why this function was disabled
+//
+// template <typename Number>
+// template <typename OtherNumber>
+// Vector<Number>::Vector (const Vector<OtherNumber>& v) :
+//             dim(v.size()),
+//             maxdim(v.size()),
+//             val(0)
+// {
+//   if (dim)
+//     {
+//       val = new Number[maxdim];
+//       Assert (val != 0, ExcOutOfMemory());
+//       copy (v.begin(), v.end(), begin());
+//     }
+// }
+
+
+
 template <typename Number>
 void Vector<Number>::reinit (const unsigned int n, const bool fast) {
   if (n==0) 
index f825a49e604e9a687c0dce1ba8d60c236308a8f4..7f7a262fd6ff5a3ef0b1b4d8b956a471c6640923 100644 (file)
@@ -5,3 +5,7 @@
 // explicit instantiations
 template class Vector<double>;
 template class Vector<float>;
+
+// see the .h file for why these functions are disabled.
+// template Vector<float>::Vector (const Vector<double>& v);
+// template Vector<double>::Vector (const Vector<float>& v);

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.