From 09354db1434859a31a3c81abebcc4018d42f2715 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Tue, 18 Jul 2017 15:38:30 -0700 Subject: Merge from Google internal for 3.4 release --- src/google/protobuf/repeated_field.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/google/protobuf/repeated_field.h') diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index a1013f63..20743fa9 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -59,7 +59,6 @@ #include #include #include -#include #include @@ -281,9 +280,6 @@ class RepeatedField PROTOBUF_FINAL { friend class Arena; typedef void InternalArenaConstructable_; - // Move the contents of |from| into |to|, possibly clobbering |from| in the - // process. For primitive types this is just a memcpy(), but it could be - // specialized for non-primitive types to, say, swap each element instead. void MoveArray(Element* to, Element* from, int size); // Copy the elements of |from| into |to|. @@ -597,6 +593,7 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase { // Reserve() and MergeFrom() to reduce code size. |extend_amount| must be > 0. void** InternalExtend(int extend_amount); + friend class AccessorHelper; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase); }; @@ -609,8 +606,7 @@ class GenericTypeHandler { #endif static inline GenericType* New(Arena* arena) { - return ::google::protobuf::Arena::CreateMaybeMessage( - arena, static_cast(0)); + return ::google::protobuf::Arena::CreateMaybeMessage(arena); } static inline GenericType* NewFromPrototype( const GenericType* prototype, ::google::protobuf::Arena* arena = NULL); @@ -2449,6 +2445,12 @@ template class RepeatedPtrFieldBackInsertIterator *field_->Add() = *ptr_to_value; return *this; } +#if LANG_CXX11 + RepeatedPtrFieldBackInsertIterator& operator=(T&& value) { + *field_->Add() = std::move(value); + return *this; + } +#endif RepeatedPtrFieldBackInsertIterator& operator*() { return *this; } -- cgit v1.2.3