Explorar el Código

Merge pull request #104693 from mihe/local-vector-move

Optimize `LocalVector::push_back` for non-trivial objects
Rémi Verschelde hace 5 meses
padre
commit
4a31936bc1
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      core/templates/local_vector.h

+ 1 - 1
core/templates/local_vector.h

@@ -64,7 +64,7 @@ public:
 		}
 		}
 
 
 		if constexpr (!std::is_trivially_constructible_v<T> && !force_trivial) {
 		if constexpr (!std::is_trivially_constructible_v<T> && !force_trivial) {
-			memnew_placement(&data[count++], T(p_elem));
+			memnew_placement(&data[count++], T(std::move(p_elem)));
 		} else {
 		} else {
 			data[count++] = std::move(p_elem);
 			data[count++] = std::move(p_elem);
 		}
 		}