You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "pitrou (via GitHub)" <gi...@apache.org> on 2026/05/13 14:59:23 UTC

Re: [PR] MINOR: [C++] use std::move to avoid unnecessary copies [arrow]

pitrou commented on code in PR #49342:
URL: https://github.com/apache/arrow/pull/49342#discussion_r3235276095


##########
cpp/src/parquet/metadata.cc:
##########
@@ -177,9 +177,9 @@ std::shared_ptr<KeyValueMetadata> FromThriftKeyValueMetadata(const Metadata& sou
     std::vector<std::string> values;
     keys.reserve(source.key_value_metadata.size());
     values.reserve(source.key_value_metadata.size());
-    for (const auto& it : source.key_value_metadata) {
-      keys.push_back(it.key);
-      values.push_back(it.value);
+    for (auto& it : source.key_value_metadata) {
+      keys.push_back(std::move(it.key));
+      values.push_back(std::move(it.value));

Review Comment:
   `source` is semantically constant (it's marked `const`) so we should not move any values from it like this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org