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>
This commit is contained in:
Marc Mutz 2023-12-07 09:38:13 +01:00
parent 72422d7d1b
commit 9dd1953218

View File

@ -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()); }