]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added implicit conversion from VectorView to const Vector
authorLuca Heltai <luca.heltai@sissa.it>
Tue, 28 Jul 2009 09:06:06 +0000 (09:06 +0000)
committerLuca Heltai <luca.heltai@sissa.it>
Tue, 28 Jul 2009 09:06:06 +0000 (09:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@19123 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/vector_view.h

index c655384bef171abae1cfa9bcb134e0243367a005..7060bdefd60e808547db0958ad5661f9f82c7b2d 100644 (file)
@@ -164,6 +164,15 @@ class VectorView : public Vector<Number>
                                      * memory. */
     ~VectorView();
 
+                                    /**
+                                     * Implicit cast to const
+                                     * Vector<Number>. This cast
+                                     * allows the use of this object
+                                     * everywhere a const
+                                     * Vector<double> is required.
+                                     */
+    operator const Vector<Number> &() const;
+    
                                     /**
                                      * The reinit function of this object has
                                      * a behavior which is different from the
@@ -275,6 +284,13 @@ VectorView<Number>::~VectorView()
 }
 
 
+template<typename Number>
+inline
+VectorView<Number>::operator const Vector<Number> &() const
+{
+  return static_cast<const Vector<Number> &> (*this);
+}
+
 
 template<typename Number>
 inline

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.