From 2c9dfcb358426e2c908ad4f280997a72adb38d87 Mon Sep 17 00:00:00 2001
From: Sebastian Kehl <sebastian.kehl@mpcdf.mpg.de>
Date: Wed, 30 Apr 2025 13:23:54 +0200
Subject: [PATCH] remove superfluous move-statements

These were superfluous and inhibiting copy elision.
---
 cpp/full_code/NSVE_Stokes_particles.cpp    |  2 +-
 cpp/particles/particle_set_input.hpp       |  2 +-
 cpp/particles/particles_input_grid.hpp     |  2 +-
 cpp/particles/particles_input_random.hpp   |  2 +-
 cpp/particles/particles_system_builder.hpp | 30 +++++++++++-----------
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/cpp/full_code/NSVE_Stokes_particles.cpp b/cpp/full_code/NSVE_Stokes_particles.cpp
index 7655f89c..00d80238 100644
--- a/cpp/full_code/NSVE_Stokes_particles.cpp
+++ b/cpp/full_code/NSVE_Stokes_particles.cpp
@@ -56,7 +56,7 @@ int NSVE_Stokes_particles<rnumber>::initialize(void)
                 tracers0_smoothness,                                                    // parameter
                 this->comm,
                 this->fs->iteration+1,
-                std::move(p2p_ghost_collisions<double, long long int>()),
+                p2p_ghost_collisions<double, long long int>(),
                 std::move(current_particles_inner_computer),
                 this->tracers0_cutoff);
     //DEBUG_MSG_WAIT(MPI_COMM_WORLD, "after call to particles_system_builder\n");
diff --git a/cpp/particles/particle_set_input.hpp b/cpp/particles/particle_set_input.hpp
index 4010c609..eb5048c8 100644
--- a/cpp/particles/particle_set_input.hpp
+++ b/cpp/particles/particle_set_input.hpp
@@ -178,7 +178,7 @@ class particle_set_input: public abstract_particles_input<partsize_t, particle_r
 
         std::vector<std::unique_ptr<particle_rnumber[]>> getMyRhs()
         {
-            return std::move(std::vector<std::unique_ptr<particle_rnumber[]>>());
+            return std::vector<std::unique_ptr<particle_rnumber[]>>();
         }
 };
 
diff --git a/cpp/particles/particles_input_grid.hpp b/cpp/particles/particles_input_grid.hpp
index 6b1a067d..27f3465a 100644
--- a/cpp/particles/particles_input_grid.hpp
+++ b/cpp/particles/particles_input_grid.hpp
@@ -223,7 +223,7 @@ class particles_input_grid: public abstract_particles_input<partsize_t, particle
 
         std::vector<std::unique_ptr<particle_rnumber[]>> getMyRhs()
         {
-            return std::move(std::vector<std::unique_ptr<particle_rnumber[]>>());
+            return std::vector<std::unique_ptr<particle_rnumber[]>>();
         }
 
         std::vector<hsize_t> getParticleFileLayout()
diff --git a/cpp/particles/particles_input_random.hpp b/cpp/particles/particles_input_random.hpp
index f4c6ad88..78ff806b 100644
--- a/cpp/particles/particles_input_random.hpp
+++ b/cpp/particles/particles_input_random.hpp
@@ -262,7 +262,7 @@ class particles_input_random: public abstract_particles_input<partsize_t, partic
 
         std::vector<std::unique_ptr<particle_rnumber[]>> getMyRhs()
         {
-            return std::move(std::vector<std::unique_ptr<particle_rnumber[]>>());
+            return std::vector<std::unique_ptr<particle_rnumber[]>>();
         }
 
         std::vector<hsize_t> getParticleFileLayout()
diff --git a/cpp/particles/particles_system_builder.hpp b/cpp/particles/particles_system_builder.hpp
index f2480f38..9c5bf5fe 100644
--- a/cpp/particles/particles_system_builder.hpp
+++ b/cpp/particles/particles_system_builder.hpp
@@ -54,13 +54,13 @@ template <class RetType,
 struct For2{
     static RetType evaluate(IterType2 value2, Args... args){
         if(CurrentIter2 == value2){
-            return std::move(Func::template instanciate<CurrentIter1, CurrentIter2>(args...));
+            return Func::template instanciate<CurrentIter1, CurrentIter2>(args...);
         }
         else{
-            return std::move(For2<RetType,
-                                        IterType1, CurrentIter1,
-                                        IterType2, CurrentIter2+IterStep2, iterTo2, IterStep2,
-                                        Func, (CurrentIter2+IterStep2 < iterTo2), Args...>::evaluate(value2, args...));
+            return For2<RetType,
+                              IterType1, CurrentIter1,
+                              IterType2, CurrentIter2+IterStep2, iterTo2, IterStep2,
+                              Func, (CurrentIter2+IterStep2 < iterTo2), Args...>::evaluate(value2, args...);
         }
     }
 };
@@ -86,16 +86,16 @@ template <class RetType,
 struct For1{
     static RetType evaluate(IterType1 value1, IterType2 value2, Args... args){
         if(CurrentIter1 == value1){
-            return std::move(For2<RetType,
-                                        IterType1, CurrentIter1,
-                                        IterType2, IterFrom2, iterTo2, IterStep2,
-                                        Func, (IterFrom2<iterTo2), Args...>::evaluate(value2, args...));
+            return For2<RetType,
+                              IterType1, CurrentIter1,
+                              IterType2, IterFrom2, iterTo2, IterStep2,
+                              Func, (IterFrom2<iterTo2), Args...>::evaluate(value2, args...);
         }
         else{
-            return std::move(For1<RetType,
-                              IterType1, CurrentIter1+IterStep1, iterTo1, IterStep1,
-                              IterType2, IterFrom2, iterTo2, IterStep2,
-                              Func, (CurrentIter1+IterStep1 < iterTo1), Args...>::evaluate(value1, value2, args...));
+            return For1<RetType,
+                    IterType1, CurrentIter1+IterStep1, iterTo1, IterStep1,
+                    IterType2, IterFrom2, iterTo2, IterStep2,
+                    Func, (CurrentIter1+IterStep1 < iterTo1), Args...>::evaluate(value1, value2, args...);
         }
     }
 };
@@ -119,10 +119,10 @@ template <class RetType,
           class IterType2, const IterType2 IterFrom2, const IterType2 iterTo2, const IterType2 IterStep2,
           class Func, typename... Args>
 inline RetType evaluate(IterType1 value1, IterType2 value2, Args... args){
-    return std::move(For1<RetType,
+    return For1<RetType,
             IterType1, IterFrom1, iterTo1, IterStep1,
             IterType2, IterFrom2, iterTo2, IterStep2,
-            Func, (IterFrom1<iterTo1), Args...>::evaluate(value1, value2, args...));
+            Func, (IterFrom1<iterTo1), Args...>::evaluate(value1, value2, args...);
 }
 
 }
-- 
GitLab