From 1e59d46e2e101cc506fa6fdefc4e63a23e81dd36 Mon Sep 17 00:00:00 2001
From: Volker Friese <v.friese@gsi.de>
Date: Sun, 21 Nov 2021 13:57:28 +0000
Subject: [PATCH] Implement move constructor and move assignment operator.

---
 core/detectors/sts/CbmStsParAsic.cxx | 23 +++++++++++++++++++++++
 core/detectors/sts/CbmStsParAsic.h   |  6 +++---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/core/detectors/sts/CbmStsParAsic.cxx b/core/detectors/sts/CbmStsParAsic.cxx
index 99fb1d292e..b41bd64ffa 100644
--- a/core/detectors/sts/CbmStsParAsic.cxx
+++ b/core/detectors/sts/CbmStsParAsic.cxx
@@ -37,6 +37,17 @@ CbmStsParAsic::CbmStsParAsic(const CbmStsParAsic& other)
 // -------------------------------------------------------------------------
 
 
+// -----   Move constructor   ----------------------------------------------
+CbmStsParAsic::CbmStsParAsic(CbmStsParAsic&& other)
+{
+  Set(other.fNofChannels, other.fNofAdc, other.fDynRange, other.fThreshold, other.fTimeResolution, other.fDeadTime,
+      other.fNoise, other.fZeroNoiseRate);
+  SetTimeOffset(other.fTimeOffset);
+  SetWalkCoef(other.fWalkCoef);
+}
+// -------------------------------------------------------------------------
+
+
 // -----   Copy assignment operator   --------------------------------------
 CbmStsParAsic& CbmStsParAsic::operator=(const CbmStsParAsic& other)
 {
@@ -49,6 +60,18 @@ CbmStsParAsic& CbmStsParAsic::operator=(const CbmStsParAsic& other)
 // -------------------------------------------------------------------------
 
 
+// -----   Move assignment operator   --------------------------------------
+CbmStsParAsic& CbmStsParAsic::operator=(CbmStsParAsic&& other)
+{
+  Set(other.fNofChannels, other.fNofAdc, other.fDynRange, other.fThreshold, other.fTimeResolution, other.fDeadTime,
+      other.fNoise, other.fZeroNoiseRate);
+  SetTimeOffset(other.fTimeOffset);
+  SetWalkCoef(other.fWalkCoef);
+  return *this;
+}
+// -------------------------------------------------------------------------
+
+
 // -----   Destructor   ----------------------------------------------------
 CbmStsParAsic::~CbmStsParAsic()
 {
diff --git a/core/detectors/sts/CbmStsParAsic.h b/core/detectors/sts/CbmStsParAsic.h
index 7721d226ae..af6f65191e 100644
--- a/core/detectors/sts/CbmStsParAsic.h
+++ b/core/detectors/sts/CbmStsParAsic.h
@@ -41,12 +41,12 @@ public:
                 double noise, double znr);
 
 
-  /** @brief Copy constructor (disabled) **/
+  /** @brief Copy constructor **/
   CbmStsParAsic(const CbmStsParAsic&);
 
 
   /** @brief Move constructor (disabled) **/
-  CbmStsParAsic(CbmStsParAsic&&) = default;
+  CbmStsParAsic(CbmStsParAsic&&);
 
 
   /** @brief Copy assignment operator **/
@@ -54,7 +54,7 @@ public:
 
 
   /** @brief Move assignment operator (disabled) **/
-  CbmStsParAsic& operator=(CbmStsParAsic&&) = default;
+  CbmStsParAsic& operator=(CbmStsParAsic&&);
 
 
   /** @brief Destructor **/
-- 
GitLab