summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-03-19 10:03:48 +0100
committerKent Hansen <kent.hansen@nokia.com>2012-03-19 10:03:48 +0100
commit95d6f8a4cf3fba2fd675f0e6b5de0ce1d702da26 (patch)
treea0bb36e478c97761afa36baf8026726b3d2fdbc8 /src/corelib/tools
parent3f64a7b67bfbcaab65ebb03f84962cce5834790b (diff)
parent25e004bfe493e18be255b057ae5c132a5ec5458b (diff)
Merge master into api_changes
Conflicts: src/corelib/tools/qvector.h tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I877256e95f3788e617437f4e9661a88047f38cd6
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qbytearray.cpp12
-rw-r--r--src/corelib/tools/qbytearray.h6
-rw-r--r--src/corelib/tools/qhash.cpp20
-rw-r--r--src/corelib/tools/qhash.h2
-rw-r--r--src/corelib/tools/qlinkedlist.cpp18
-rw-r--r--src/corelib/tools/qlinkedlist.h2
-rw-r--r--src/corelib/tools/qlist.cpp18
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qmap.cpp20
-rw-r--r--src/corelib/tools/qmap.h2
-rw-r--r--src/corelib/tools/qregularexpression.cpp39
-rw-r--r--src/corelib/tools/qset.h2
-rw-r--r--src/corelib/tools/qset.qdoc18
-rw-r--r--src/corelib/tools/qstring.cpp18
-rw-r--r--src/corelib/tools/qstring.h6
-rw-r--r--src/corelib/tools/qvarlengtharray.h2
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc18
-rw-r--r--src/corelib/tools/qvector.cpp18
-rw-r--r--src/corelib/tools/qvector.h2
19 files changed, 212 insertions, 13 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index ea6f5c4626..7f4d35d82c 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -800,6 +800,12 @@ const QStaticByteArrayData<1> QByteArray::shared_empty = { { Q_REFCOUNT_INITIALI
\internal
*/
+/*! \fn QByteArray::const_iterator QByteArray::cbegin() const
+ \since 5.0
+
+ \internal
+*/
+
/*! \fn QByteArray::const_iterator QByteArray::constBegin() const
\internal
@@ -815,6 +821,12 @@ const QStaticByteArrayData<1> QByteArray::shared_empty = { { Q_REFCOUNT_INITIALI
\internal
*/
+/*! \fn QByteArray::const_iterator QByteArray::cend() const
+ \since 5.0
+
+ \internal
+*/
+
/*! \fn QByteArray::const_iterator QByteArray::constEnd() const
\internal
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index bd3a4a8444..1e70e26be3 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -354,9 +354,11 @@ public:
typedef const_iterator ConstIterator;
iterator begin();
const_iterator begin() const;
+ const_iterator cbegin() const;
const_iterator constBegin() const;
iterator end();
const_iterator end() const;
+ const_iterator cend() const;
const_iterator constEnd() const;
// stl compatibility
@@ -495,12 +497,16 @@ inline QByteArray::iterator QByteArray::begin()
{ detach(); return d->data(); }
inline QByteArray::const_iterator QByteArray::begin() const
{ return d->data(); }
+inline QByteArray::const_iterator QByteArray::cbegin() const
+{ return d->data(); }
inline QByteArray::const_iterator QByteArray::constBegin() const
{ return d->data(); }
inline QByteArray::iterator QByteArray::end()
{ detach(); return d->data() + d->size; }
inline QByteArray::const_iterator QByteArray::end() const
{ return d->data() + d->size; }
+inline QByteArray::const_iterator QByteArray::cend() const
+{ return d->data() + d->size; }
inline QByteArray::const_iterator QByteArray::constEnd() const
{ return d->data() + d->size; }
inline QByteArray &QByteArray::operator+=(char c)
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 897de77f2e..e418158a20 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -1045,6 +1045,15 @@ void QHashData::checkSanity()
\overload
*/
+/*! \fn QHash::const_iterator QHash::cbegin() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the first item
+ in the hash.
+
+ \sa begin(), cend()
+*/
+
/*! \fn QHash::const_iterator QHash::constBegin() const
Returns a const \l{STL-style iterator} pointing to the first item
@@ -1074,6 +1083,15 @@ void QHashData::checkSanity()
\sa constBegin(), end()
*/
+/*! \fn QHash::const_iterator QHash::cend() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the imaginary
+ item after the last item in the hash.
+
+ \sa cbegin(), end()
+*/
+
/*! \fn QHash::iterator QHash::erase(iterator pos)
Removes the (key, value) pair associated with the iterator \a pos
@@ -1114,7 +1132,7 @@ void QHashData::checkSanity()
\overload
*/
-/*! \fn QHash::iterator QHash::constFind(const Key &key) const
+/*! \fn QHash::const_iterator QHash::constFind(const Key &key) const
\since 4.1
Returns an iterator pointing to the item with the \a key in the
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 91d015c394..73162b6cf1 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -440,9 +440,11 @@ public:
// STL style
inline iterator begin() { detach(); return iterator(d->firstNode()); }
inline const_iterator begin() const { return const_iterator(d->firstNode()); }
+ inline const_iterator cbegin() const { return const_iterator(d->firstNode()); }
inline const_iterator constBegin() const { return const_iterator(d->firstNode()); }
inline iterator end() { detach(); return iterator(e); }
inline const_iterator end() const { return const_iterator(e); }
+ inline const_iterator cend() const { return const_iterator(e); }
inline const_iterator constEnd() const { return const_iterator(e); }
iterator erase(iterator it);
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
index 6e66f804c0..1502f70d56 100644
--- a/src/corelib/tools/qlinkedlist.cpp
+++ b/src/corelib/tools/qlinkedlist.cpp
@@ -330,6 +330,15 @@ const QLinkedListData QLinkedListData::shared_null = {
\overload
*/
+/*! \fn QLinkedList::const_iterator QLinkedList::cbegin() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the first item
+ in the list.
+
+ \sa begin(), cend()
+*/
+
/*! \fn QLinkedList::const_iterator QLinkedList::constBegin() const
Returns a const \l{STL-style iterator} pointing to the first item
@@ -351,6 +360,15 @@ const QLinkedListData QLinkedListData::shared_null = {
\overload
*/
+/*! \fn QLinkedList::const_iterator QLinkedList::cend() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the imaginary
+ item after the last item in the list.
+
+ \sa cbegin(), end()
+*/
+
/*! \fn QLinkedList::const_iterator QLinkedList::constEnd() const
Returns a const \l{STL-style iterator} pointing to the imaginary
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 28f190c7fa..27d0ffe875 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -180,9 +180,11 @@ public:
// stl style
inline iterator begin() { detach(); return e->n; }
inline const_iterator begin() const { return e->n; }
+ inline const_iterator cbegin() const { return e->n; }
inline const_iterator constBegin() const { return e->n; }
inline iterator end() { detach(); return e; }
inline const_iterator end() const { return e; }
+ inline const_iterator cend() const { return e; }
inline const_iterator constEnd() const { return e; }
iterator insert(iterator before, const T &t);
iterator erase(iterator pos);
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 9ee4c0a797..c87b3e7d24 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -919,6 +919,15 @@ void **QListData::erase(void **xi)
\overload
*/
+/*! \fn QList::const_iterator QList::cbegin() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the first item
+ in the list.
+
+ \sa begin(), cend()
+*/
+
/*! \fn QList::const_iterator QList::constBegin() const
Returns a const \l{STL-style iterator} pointing to the first item
@@ -940,6 +949,15 @@ void **QListData::erase(void **xi)
\overload
*/
+/*! \fn QList::const_iterator QList::cend() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the imaginary
+ item after the last item in the list.
+
+ \sa cbegin(), end()
+*/
+
/*! \fn QList::const_iterator QList::constEnd() const
Returns a const \l{STL-style iterator} pointing to the imaginary
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index bc3350f42b..a15b0c9124 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -269,9 +269,11 @@ public:
// stl style
inline iterator begin() { detach(); return reinterpret_cast<Node *>(p.begin()); }
inline const_iterator begin() const { return reinterpret_cast<Node *>(p.begin()); }
+ inline const_iterator cbegin() const { return reinterpret_cast<Node *>(p.begin()); }
inline const_iterator constBegin() const { return reinterpret_cast<Node *>(p.begin()); }
inline iterator end() { detach(); return reinterpret_cast<Node *>(p.end()); }
inline const_iterator end() const { return reinterpret_cast<Node *>(p.end()); }
+ inline const_iterator cend() const { return reinterpret_cast<Node *>(p.end()); }
inline const_iterator constEnd() const { return reinterpret_cast<Node *>(p.end()); }
iterator insert(iterator before, const T &t);
iterator erase(iterator pos);
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index c922d7aab0..b585bdbbc8 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -682,6 +682,15 @@ void QMapData::dump()
\overload
*/
+/*! \fn QMap::const_iterator QMap::cbegin() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the first item
+ in the map.
+
+ \sa begin(), cend()
+*/
+
/*! \fn QMap::const_iterator QMap::constBegin() const
Returns a const \l{STL-style iterator} pointing to the first item
@@ -703,6 +712,15 @@ void QMapData::dump()
\overload
*/
+/*! \fn QMap::const_iterator QMap::cend() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the imaginary
+ item after the last item in the map.
+
+ \sa cbegin(), end()
+*/
+
/*! \fn QMap::const_iterator QMap::constEnd() const
Returns a const \l{STL-style iterator} pointing to the imaginary
@@ -744,7 +762,7 @@ void QMapData::dump()
\overload
*/
-/*! \fn QMap::iterator QMap::constFind(const Key &key) const
+/*! \fn QMap::const_iterator QMap::constFind(const Key &key) const
\since 4.1
Returns an const iterator pointing to the item with key \a key in the
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index dc358a8106..dbbbcce162 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -362,12 +362,14 @@ public:
// STL style
inline iterator begin() { detach(); return iterator(e->forward[0]); }
inline const_iterator begin() const { return const_iterator(e->forward[0]); }
+ inline const_iterator cbegin() const { return const_iterator(e->forward[0]); }
inline const_iterator constBegin() const { return const_iterator(e->forward[0]); }
inline iterator end() {
detach();
return iterator(e);
}
inline const_iterator end() const { return const_iterator(e); }
+ inline const_iterator cend() const { return const_iterator(e); }
inline const_iterator constEnd() const { return const_iterator(e); }
iterator erase(iterator it);
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index 1db78519a3..eaa20b304a 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -135,7 +135,7 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 2
- The pattern() function returns the pattern that it's currently set for a
+ The pattern() function returns the pattern that is currently set for a
QRegularExpression object:
\snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 3
@@ -342,9 +342,9 @@ QT_BEGIN_NAMESPACE
string; however, the subpattern \c{def} matches the subject string
completely, and therefore a complete match is reported.
- In case multiple partial matches are found when matching (but no complete
- match), then the QRegularExpressionMatch will report the first one that it
- is found. For instance:
+ If multiple partial matches are found when matching (but no complete
+ match), then the QRegularExpressionMatch object will report the first one
+ that is found. For instance:
\snippet doc/src/snippets/code/src_corelib_tools_qregularexpression.cpp 18
@@ -440,7 +440,7 @@ QT_BEGIN_NAMESPACE
\section2 Exact matching
- QRegExp::exactMatch in Qt 4 served for two purposes: it exactly matched
+ QRegExp::exactMatch() in Qt 4 served two purposes: it exactly matched
a regular expression against a subject string, and it implemented partial
matching. In fact, if an exact match was not found, one could still find
out how much of the subject string was matched by the regular expression
@@ -478,9 +478,20 @@ QT_BEGIN_NAMESPACE
matching correctly (that is, like Perl does). In particular, patterns that
can match 0 characters (like \c{"a*"}) are problematic.
- QRegularExpression::globalMatch implements Perl global match correctly, and
+ QRegularExpression::globalMatch() implements Perl global match correctly, and
the returned iterator can be used to examine each result.
+ \section2 Unicode properties support
+
+ When using QRegExp, character classes such as \c{\w}, \c{\d}, etc. match
+ characters with the corresponding Unicode property: for instance, \c{\d}
+ matches any character with the Unicode Nd (decimal digit) property.
+
+ Those character classes only match ASCII characters by default when using
+ QRegularExpression: for instance, \c{\d} matches exactly a character in the
+ \c{0-9} ASCII range. It is possible to change this behaviour by using the
+ UseUnicodePropertiesOption pattern option.
+
\section2 Wildcard matching
There is no equivalent of wildcard matching in QRegularExpression.
@@ -494,11 +505,11 @@ QT_BEGIN_NAMESPACE
\section2 Minimal matching
- QRegExp::setMinimal implemented minimal matching by simply reversing the
+ QRegExp::setMinimal() implemented minimal matching by simply reversing the
greediness of the quantifiers (QRegExp did not support lazy quantifiers,
like \c{*?}, \c{+?}, etc.). QRegularExpression instead does support greedy,
lazy and possessive quantifiers. The InvertedGreedinessOption
- pattern option can be useful to emulate the effects of QRegExp::setMinimal:
+ pattern option can be useful to emulate the effects of QRegExp::setMinimal():
if enabled, it inverts the greediness of quantifiers (greedy ones become
lazy and vice versa).
@@ -675,7 +686,7 @@ QT_BEGIN_NAMESPACE
equivalent for this option in Perl regular expressions.
\value UseUnicodePropertiesOption
- The meaning of the \c{\w}, \c{\d}, etc., character types, as well as
+ The meaning of the \c{\w}, \c{\d}, etc., character classes, as well as
the meaning of their counterparts (\c{\W}, \c{\D}, etc.), is changed
from matching ASCII charaters only to matching any character with the
corresponding Unicode property. For instance, \c{\d} is changed to
@@ -1004,12 +1015,18 @@ class QPcreJitStackPointer
Q_DISABLE_COPY(QPcreJitStackPointer);
public:
+ /*!
+ \internal
+ */
QPcreJitStackPointer()
{
// The default JIT stack size in PCRE is 32K,
// we allocate from 32K up to 512K.
stack = pcre16_jit_stack_alloc(32*1024, 512*1024);
}
+ /*!
+ \internal
+ */
~QPcreJitStackPointer()
{
if (stack)
@@ -1572,8 +1589,8 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const
a backslash all characters in \a str, except for the characters in the
\c{[A-Z]}, \c{[a-z]} and \c{[0-9]} ranges, as well as the underscore
(\c{_}) character. The only difference with Perl is that a literal NUL
- inside \a str is escaped with the sequence \c{"\\\\0"} (backslash +
- \c{'0'}), instead of \c{"\\\\\\0"} (backslash + \c{NUL}).
+ inside \a str is escaped with the sequence \c{"\\0"} (backslash +
+ \c{'0'}), instead of \c{"\\\0"} (backslash + \c{NUL}).
*/
QString QRegularExpression::escape(const QString &str)
{
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 7750cd1147..e85c770d42 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -164,9 +164,11 @@ public:
// STL style
inline iterator begin() { return q_hash.begin(); }
inline const_iterator begin() const { return q_hash.begin(); }
+ inline const_iterator cbegin() const { return q_hash.begin(); }
inline const_iterator constBegin() const { return q_hash.constBegin(); }
inline iterator end() { return q_hash.end(); }
inline const_iterator end() const { return q_hash.end(); }
+ inline const_iterator cend() const { return q_hash.end(); }
inline const_iterator constEnd() const { return q_hash.constEnd(); }
iterator erase(iterator i)
{ return q_hash.erase(reinterpret_cast<typename Hash::iterator &>(i)); }
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index b33064e1b8..139b017966 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -343,6 +343,15 @@
item in the set.
*/
+/*! \fn QSet::const_iterator QSet::cbegin() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} positioned at the first
+ item in the set.
+
+ \sa begin(), cend()
+*/
+
/*! \fn QSet::const_iterator QSet::constBegin() const
Returns a const \l{STL-style iterator} positioned at the first
@@ -367,6 +376,15 @@
imaginary item after the last item in the set.
*/
+/*! \fn QSet::const_iterator QSet::cend() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the imaginary
+ item after the last item in the set.
+
+ \sa cbegin(), end()
+*/
+
/*! \fn QSet::const_iterator QSet::constEnd() const
Returns a const \l{STL-style iterator} pointing to the imaginary
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 878403fe75..cf09e2b5dc 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -862,6 +862,15 @@ int QString::grow(int size)
\overload begin()
*/
+/*! \fn QString::const_iterator QString::cbegin() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the first character
+ in the string.
+
+ \sa begin(), cend()
+*/
+
/*! \fn QString::const_iterator QString::constBegin() const
Returns a const \l{STL-style iterator} pointing to the first character
@@ -883,6 +892,15 @@ int QString::grow(int size)
\overload end()
*/
+/*! \fn QString::const_iterator QString::cend() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the imaginary
+ item after the last item in the list.
+
+ \sa cbegin(), end()
+*/
+
/*! \fn QString::const_iterator QString::constEnd() const
Returns a const \l{STL-style iterator} pointing to the imaginary
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 781afc5bba..fa5ef3bbf0 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -573,9 +573,11 @@ public:
typedef const_iterator ConstIterator;
iterator begin();
const_iterator begin() const;
+ const_iterator cbegin() const;
const_iterator constBegin() const;
iterator end();
const_iterator end() const;
+ const_iterator cend() const;
const_iterator constEnd() const;
// STL compatibility
@@ -921,12 +923,16 @@ inline QString::iterator QString::begin()
{ detach(); return reinterpret_cast<QChar*>(d->data()); }
inline QString::const_iterator QString::begin() const
{ return reinterpret_cast<const QChar*>(d->data()); }
+inline QString::const_iterator QString::cbegin() const
+{ return reinterpret_cast<const QChar*>(d->data()); }
inline QString::const_iterator QString::constBegin() const
{ return reinterpret_cast<const QChar*>(d->data()); }
inline QString::iterator QString::end()
{ detach(); return reinterpret_cast<QChar*>(d->data() + d->size); }
inline QString::const_iterator QString::end() const
{ return reinterpret_cast<const QChar*>(d->data() + d->size); }
+inline QString::const_iterator QString::cend() const
+{ return reinterpret_cast<const QChar*>(d->data() + d->size); }
inline QString::const_iterator QString::constEnd() const
{ return reinterpret_cast<const QChar*>(d->data() + d->size); }
inline bool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index a6613a3774..4e042f765e 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -160,9 +160,11 @@ public:
inline iterator begin() { return ptr; }
inline const_iterator begin() const { return ptr; }
+ inline const_iterator cbegin() const { return ptr; }
inline const_iterator constBegin() const { return ptr; }
inline iterator end() { return ptr + s; }
inline const_iterator end() const { return ptr + s; }
+ inline const_iterator cend() const { return ptr + s; }
inline const_iterator constEnd() const { return ptr + s; }
iterator insert(iterator before, int n, const T &x);
inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); }
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index e1dc2bee9a..e92f91aa47 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -451,6 +451,15 @@
\overload
*/
+/*! \fn QVarLengthArray::const_iterator QVarLengthArray::cbegin() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the first item
+ in the array.
+
+ \sa begin(), cend()
+*/
+
/*! \fn QVarLengthArray::const_iterator QVarLengthArray::constBegin() const
\since 4.8
@@ -475,6 +484,15 @@
\overload
*/
+/*! \fn QVarLengthArray::const_iterator QVarLengthArray::cend() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the imaginary
+ item after the last item in the array.
+
+ \sa cbegin(), end()
+*/
+
/*! \fn QVarLengthArray::const_iterator QVarLengthArray::constEnd() const
\since 4.8
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index 1a746dc061..0026338047 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -688,6 +688,15 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT)
\overload
*/
+/*! \fn QVector::const_iterator QVector::cbegin() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the first item
+ in the vector.
+
+ \sa begin(), cend()
+*/
+
/*! \fn QVector::const_iterator QVector::constBegin() const
Returns a const \l{STL-style iterator} pointing to the first item
@@ -709,6 +718,15 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT)
\overload
*/
+/*! \fn QVector::const_iterator QVector::cend() const
+ \since 5.0
+
+ Returns a const \l{STL-style iterator} pointing to the imaginary
+ item after the last item in the vector.
+
+ \sa cbegin(), end()
+*/
+
/*! \fn QVector::const_iterator QVector::constEnd() const
Returns a const \l{STL-style iterator} pointing to the imaginary
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index c119ef43ae..226d0bb258 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -248,9 +248,11 @@ public:
#endif
inline iterator begin() { detach(); return d->begin(); }
inline const_iterator begin() const { return d->begin(); }
+ inline const_iterator cbegin() const { return d->begin(); }
inline const_iterator constBegin() const { return d->begin(); }
inline iterator end() { detach(); return d->end(); }
inline const_iterator end() const { return d->end(); }
+ inline const_iterator cend() const { return d->end(); }
inline const_iterator constEnd() const { return d->end(); }
iterator insert(iterator before, int n, const T &x);
inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); }