summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-12-07 09:38:13 +0100
committerMarc Mutz <marc.mutz@qt.io>2023-12-07 23:55:07 +0100
commit9dd19532187bd6a5465e6c98a554d24dad1d06d0 (patch)
treead154667700058afa68d497026c80844b7669f3c
parent72422d7d1b2a1f71415b5662724f88f490eadaf8 (diff)
QByteArray: bring end() into idiomatic form
For contiguous containers, end() is always begin() + size(), so use that instead of data() + size(). Centralizes what it means to be an iterator in just begin() now, which will simplify a follow-up commit of Thiago's. Pick-to: 6.6 6.5 Change-Id: I53ca1a335910bdea3d46b9496ba39bc1a2d3fd93 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/text/qbytearray.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index 1f3316eed6..aeeeb15e0e 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -477,8 +477,8 @@ public:
const_iterator begin() const noexcept { return data(); }
const_iterator cbegin() const noexcept { return begin(); }
const_iterator constBegin() const noexcept { return begin(); }
- iterator end() { return data() + size(); }
- const_iterator end() const noexcept { return data() + size(); }
+ iterator end() { return begin() + size(); }
+ const_iterator end() const noexcept { return begin() + size(); }
const_iterator cend() const noexcept { return end(); }
const_iterator constEnd() const noexcept { return end(); }
reverse_iterator rbegin() { return reverse_iterator(end()); }