From: Wolfgang Bangerth Date: Sun, 21 Feb 2010 03:29:20 +0000 (+0000) Subject: Add another copy operator to VectorReference. X-Git-Tag: v8.0.0~6417 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b174b74c57c11c9823f975bf1c8dcc32f08cc771;p=dealii.git Add another copy operator to VectorReference. git-svn-id: https://svn.dealii.org/trunk@20659 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/petsc_vector_base.h b/deal.II/lac/include/lac/petsc_vector_base.h index be7d1385ef..b7db5d070a 100644 --- a/deal.II/lac/include/lac/petsc_vector_base.h +++ b/deal.II/lac/include/lac/petsc_vector_base.h @@ -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 s. @@ -813,6 +823,17 @@ namespace PETScWrappers + inline + VectorReference & + VectorReference::operator = (const VectorReference &r) + { + // simply call the other operator + static_cast(*this)> = r; + return this; + } + + + inline const VectorReference & VectorReference::operator = (const PetscScalar &value) const