From 7ba29dbe412a25568c8797416c00de47bdac892e Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Wed, 20 May 2015 16:19:50 -0700 Subject: [PATCH] Small readability improvements to recent commits. Change-Id: I290c33c475f7b019ab0d3c571245d27351d22fa1 Tested: on Linux. --- include/flatbuffers/flatbuffers.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 6f120f6b7..9502464a7 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -287,8 +287,8 @@ public: iterator begin() { return iterator(Data(), 0); } const_iterator begin() const { return const_iterator(Data(), 0); } - iterator end() { return iterator(Data(), EndianScalar(length_)); } - const_iterator end() const { return const_iterator(Data(), EndianScalar(length_)); } + iterator end() { return iterator(Data(), size()); } + const_iterator end() const { return const_iterator(Data(), size()); } // Change elements if you have a non-const pointer to this object. void Mutate(uoffset_t i, T val) { @@ -306,8 +306,7 @@ public: } template return_type LookupByKey(K key) const { - std::size_t count = size(); - void *search_result = std::bsearch(&key, Data(), count, + void *search_result = std::bsearch(&key, Data(), size(), IndirectHelper::element_stride, KeyCompare); if (!search_result) {