]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add another copy operator to VectorReference.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 21 Feb 2010 03:29:20 +0000 (03:29 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 21 Feb 2010 03:29:20 +0000 (03:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@20659 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/petsc_vector_base.h

index be7d1385efd045175750145286b2053c379093c7..b7db5d070af8c9151da2b845728ae005c510baf1 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2004, 2005, 2006, 2007, 2009 by the deal.II authors
+//    Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -109,6 +109,16 @@ namespace PETScWrappers
                                           */
         const VectorReference & operator = (const VectorReference &r) const;
 
+                                        /**
+                                         * The same function as above, but
+                                         * for non-const reference
+                                         * objects. The function is needed
+                                         * since the compiler might otherwise
+                                         * automatically generate a copy
+                                         * operator for non-const objects.
+                                         */
+        VectorReference & operator = (const VectorReference &r);
+       
                                          /**
                                           * Set the referenced element of the
                                           * vector to <tt>s</tt>.
@@ -813,6 +823,17 @@ namespace PETScWrappers
 
 
 
+    inline
+    VectorReference &
+    VectorReference::operator = (const VectorReference &r) 
+    {
+                                      // simply call the other operator
+      static_cast<const VectorReference &>(*this)> = r;
+      return this;
+    }
+    
+
+
     inline
     const VectorReference &
     VectorReference::operator = (const PetscScalar &value) const

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.