From 13aeddd1b8e32d60f08bbe16edd5a47901d5236b Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Thu, 17 Mar 2016 17:36:23 +0100 Subject: [PATCH] [MaL] assignment operators * copy returns *this * move explicitly deleted --- MathLib/LinAlg/PETSc/PETScVector.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MathLib/LinAlg/PETSc/PETScVector.h b/MathLib/LinAlg/PETSc/PETScVector.h index b2de22be172..ce15cbe8f46 100644 --- a/MathLib/LinAlg/PETSc/PETScVector.h +++ b/MathLib/LinAlg/PETSc/PETScVector.h @@ -223,12 +223,19 @@ class PETScVector void setZero() { *this = 0.0; } /// Overloaded operator: assign - void operator = (const PETScVector &v_in) + PETScVector& operator = (const PETScVector &v_in) { if (!_v) shallowCopy(v_in); VecCopy(*v_in._v, *_v); + + return *this; } + /// Disallow moving. + /// \todo This operator should be implemented properly when doing a + /// general cleanup of all matrix and vector classes. + PETScVector& operator = (PETScVector &&) = delete; + /// Overloaded operator: add void operator += (const PETScVector& v_in) { -- GitLab