diff --git a/src/corelib/serialization/qjsonarray.cpp b/src/corelib/serialization/qjsonarray.cpp index 5ba83c41b9..7dfa9b43f0 100644 --- a/src/corelib/serialization/qjsonarray.cpp +++ b/src/corelib/serialization/qjsonarray.cpp @@ -675,6 +675,14 @@ bool QJsonArray::operator!=(const QJsonArray &other) const \sa begin(), constEnd() */ +/*! \fn QJsonArray::const_iterator QJsonArray::cbegin() const + + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item + in the array. + + \sa begin(), cend() +*/ + /*! \fn QJsonArray::iterator QJsonArray::end() Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item @@ -696,6 +704,14 @@ bool QJsonArray::operator!=(const QJsonArray &other) const \sa constBegin(), end() */ +/*! \fn QJsonArray::const_iterator QJsonArray::cend() const + + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary + item after the last item in the array. + + \sa cbegin(), end() +*/ + /*! \fn void QJsonArray::push_back(const QJsonValue &value) This function is provided for STL compatibility. It is equivalent diff --git a/src/corelib/serialization/qjsonarray.h b/src/corelib/serialization/qjsonarray.h index 0a17951fb7..ba346fb848 100644 --- a/src/corelib/serialization/qjsonarray.h +++ b/src/corelib/serialization/qjsonarray.h @@ -214,9 +214,11 @@ public: inline iterator begin() { detach2(); return iterator(this, 0); } inline const_iterator begin() const { return const_iterator(this, 0); } inline const_iterator constBegin() const { return const_iterator(this, 0); } + inline const_iterator cbegin() const { return const_iterator(this, 0); } inline iterator end() { detach2(); return iterator(this, size()); } inline const_iterator end() const { return const_iterator(this, size()); } inline const_iterator constEnd() const { return const_iterator(this, size()); } + inline const_iterator cend() const { return const_iterator(this, size()); } iterator insert(iterator before, const QJsonValue &value) { insert(before.i, value); return before; } iterator erase(iterator it) { removeAt(it.i); return it; }