From c12040ccaf8abb0b35fef4e8bc6df9565669f4df Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 21 Feb 2010 03:29:20 +0000 Subject: [PATCH] Add another copy operator to VectorReference. git-svn-id: https://svn.dealii.org/trunk@20659 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/petsc_vector_base.h | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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 -- 2.39.5