]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Corrected assignment operator:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Dec 2007 16:46:29 +0000 (16:46 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Dec 2007 16:46:29 +0000 (16:46 +0000)
- call Copy function only once
- check for assignment to self
(Laurent)

MUON/AliMUONCluster.cxx
MUON/AliMUONDigit.cxx
MUON/AliMUONObjectPair.cxx

index d8e22c74461b08deda5b56423f0106720362d8b3..3fb8fe5504d6d79c3707704e9ca7241e85ae2fa4 100644 (file)
@@ -129,8 +129,10 @@ AliMUONCluster&
 AliMUONCluster::operator=(const AliMUONCluster& src)
 {
   /// assignement operator
-  AliMUONCluster c(src);
-  c.Copy(*this);
+  if ( this != &src ) 
+  {
+    src.Copy(*this);
+  }
   return *this;
 }
 
index 5d682aafb6a5310d901d005572c53c226da6c978..61b4a8a4c1c5a2b219003576f06db8b53161e4b3 100644 (file)
@@ -347,8 +347,10 @@ AliMUONDigit::operator=(const AliMUONDigit& digit)
 {
   /// Assignement operator.
 
-  AliMUONDigit a(digit);
-  a.Copy(*this);
+  if ( this != &digit ) 
+  {
+    digit.Copy(*this);
+  }
   return *this;
 }
 
index 6fc64a8051cc162f61a157f0db03b076bcd36439..38b39ed8fba925de630d2edd524c7e3df9ebb1ee 100644 (file)
@@ -88,9 +88,10 @@ AliMUONObjectPair&
 AliMUONObjectPair::operator=(const AliMUONObjectPair& other)
 {
   /// assignement operator
-  AliDebug(1,"");
-  AliMUONObjectPair pair(other);
-  pair.Copy(*this);
+  if ( this != &other)
+  {
+    other.Copy(*this);
+  }
   return *this;
 }