You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2017/12/08 00:03:47 UTC

[3/3] mesos git commit: Added a RepeatedPtrField to vector conversion overload for rvalues.

Added a RepeatedPtrField to vector conversion overload for rvalues.

This enables moving the individual entries out into the output vector.

Review: https://reviews.apache.org/r/64427


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/108eb063
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/108eb063
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/108eb063

Branch: refs/heads/master
Commit: 108eb0631ec84251812981182f24979216c3a1c0
Parents: ea98a34
Author: Benjamin Mahler <bm...@apache.org>
Authored: Thu Dec 7 11:59:46 2017 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Dec 7 16:03:23 2017 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/protobuf.hpp | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/108eb063/3rdparty/libprocess/include/process/protobuf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/protobuf.hpp b/3rdparty/libprocess/include/process/protobuf.hpp
index 257832e..5a75a83 100644
--- a/3rdparty/libprocess/include/process/protobuf.hpp
+++ b/3rdparty/libprocess/include/process/protobuf.hpp
@@ -19,6 +19,7 @@
 #include <google/protobuf/message.h>
 #include <google/protobuf/repeated_field.h>
 
+#include <iterator>
 #include <set>
 #include <vector>
 
@@ -82,6 +83,15 @@ std::vector<T> convert(const google::protobuf::RepeatedPtrField<T>& items)
   return std::vector<T>(items.begin(), items.end());
 }
 
+
+template <typename T>
+std::vector<T> convert(google::protobuf::RepeatedPtrField<T>&& items)
+{
+  return std::vector<T>(
+      std::make_move_iterator(items.begin()),
+      std::make_move_iterator(items.end()));
+}
+
 } // namespace protobuf {
 } // namespace google {