aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/reflection.h
diff options
context:
space:
mode:
authorGravatar Bo Yang <teboring@google.com>2016-09-19 13:45:07 -0700
committerGravatar Bo Yang <teboring@google.com>2016-10-10 11:23:36 -0700
commitcc8ca5b6a5478b40546d4206392eb1471454460d (patch)
treec0b45abfa16d7d373a6ea8f7fe50f1de00ab938e /src/google/protobuf/reflection.h
parent337a028bb65ccca4dda768695950b5aba53ae2c9 (diff)
Integrate internal changes
Diffstat (limited to 'src/google/protobuf/reflection.h')
-rwxr-xr-xsrc/google/protobuf/reflection.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/google/protobuf/reflection.h b/src/google/protobuf/reflection.h
index 2391f453..d5a6653c 100755
--- a/src/google/protobuf/reflection.h
+++ b/src/google/protobuf/reflection.h
@@ -80,6 +80,12 @@ class RepeatedFieldRef<
typedef IteratorType iterator;
typedef IteratorType const_iterator;
+ typedef T value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef int size_type;
+ typedef ptrdiff_t difference_type;
+
iterator begin() const {
return iterator(data_, accessor_, true);
}
@@ -202,11 +208,18 @@ class RepeatedFieldRef<
typedef IteratorType iterator;
typedef IteratorType const_iterator;
+ typedef T value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef int size_type;
+ typedef ptrdiff_t difference_type;
+
iterator begin() const {
return iterator(data_, accessor_, true, NewMessage());
}
iterator end() const {
- return iterator(data_, accessor_, false, NewMessage());
+ // The end iterator must not be dereferenced, no need for scratch space.
+ return iterator(data_, accessor_, false, NULL);
}
private:
@@ -428,13 +441,13 @@ class RepeatedFieldRefIterator
public:
// Constructor for non-message fields.
RepeatedFieldRefIterator(const void* data,
- const RepeatedFieldAccessor* accessor,
- bool begin)
- : data_(data), accessor_(accessor),
- iterator_(begin ? accessor->BeginIterator(data) :
- accessor->EndIterator(data)),
- scratch_space_(new AccessorValueType) {
- }
+ const RepeatedFieldAccessor* accessor, bool begin)
+ : data_(data),
+ accessor_(accessor),
+ iterator_(begin ? accessor->BeginIterator(data)
+ : accessor->EndIterator(data)),
+ // The end iterator must not be dereferenced, no need for scratch space.
+ scratch_space_(begin ? new AccessorValueType : NULL) {}
// Constructor for message fields.
RepeatedFieldRefIterator(const void* data,
const RepeatedFieldAccessor* accessor,