You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by dk...@apache.org on 2020/05/15 17:52:39 UTC

[avro] branch master updated: Use std::move in C++ decode vector and map operations

This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new b2c5809  Use std::move in C++ decode vector and map operations
b2c5809 is described below

commit b2c58098704b9ffc70e40f657915fe820126e3d7
Author: Andrew Nelless <nl...@users.noreply.github.com>
AuthorDate: Tue Apr 28 20:17:29 2020 +0100

    Use std::move in C++ decode vector and map operations
---
 lang/c++/api/Specific.hh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lang/c++/api/Specific.hh b/lang/c++/api/Specific.hh
index cdb1b01..53741be 100644
--- a/lang/c++/api/Specific.hh
+++ b/lang/c++/api/Specific.hh
@@ -247,7 +247,7 @@ template <typename T> struct codec_traits<std::vector<T> > {
             for (size_t i = 0; i < n; ++i) {
                 T t;
                 avro::decode(d, t);
-                s.push_back(t);
+                s.push_back(std::move(t));
             }
         }
     }
@@ -296,9 +296,8 @@ template <typename T> struct codec_traits<std::map<std::string, T> > {
             for (size_t i = 0; i < n; ++i) {
                 std::string k;
                 avro::decode(d, k);
-                T t;
+                T& t = s[std::move(k)];
                 avro::decode(d, t);
-                s[k] = t;
             }
         }
     }