summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qlist.h46
-rw-r--r--src/corelib/tools/qlist.qdoc26
2 files changed, 37 insertions, 35 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 34d67c7c92..c7b96a59d6 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -84,9 +84,9 @@ class QList
: public QListSpecialMethods<T>
#endif
{
- typedef QTypedArrayData<T> Data;
- typedef QArrayDataOps<T> DataOps;
- typedef QArrayDataPointer<T> DataPointer;
+ using Data = QTypedArrayData<T>;
+ using DataOps = QArrayDataOps<T>;
+ using DataPointer = QArrayDataPointer<T>;
class DisableRValueRefs {};
DataPointer d;
@@ -95,22 +95,32 @@ class QList
template <typename V, typename U> friend qsizetype QtPrivate::lastIndexOf(const QList<V> &list, const U &u, qsizetype from) noexcept;
public:
- typedef T Type;
- typedef T value_type;
- typedef value_type *pointer;
- typedef const value_type *const_pointer;
- typedef value_type &reference;
- typedef const value_type &const_reference;
- typedef qsizetype size_type;
- typedef qptrdiff difference_type;
- typedef typename Data::iterator iterator;
- typedef typename Data::const_iterator const_iterator;
- typedef iterator Iterator;
- typedef const_iterator ConstIterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef typename DataPointer::parameter_type parameter_type;
+ using Type = T;
+ using value_type = T;
+ using pointer = T *;
+ using const_pointer = const T *;
+ using reference = T &;
+ using const_reference = const T &;
+ using size_type = qsizetype;
+ using difference_type = qptrdiff;
+#ifndef Q_QDOC
+ using iterator = typename Data::iterator;
+ using const_iterator = typename Data::const_iterator;
+#else // simplified aliases for QDoc
+ using iterator = T *;
+ using const_iterator = const T *;
+#endif
+ using Iterator = iterator;
+ using ConstIterator = const_iterator;
+ using reverse_iterator = std::reverse_iterator<iterator>;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+#ifndef Q_QDOC
+ using parameter_type = typename DataPointer::parameter_type;
using rvalue_ref = typename std::conditional<DataPointer::pass_parameter_by_value, DisableRValueRefs, T &&>::type;
+#else // simplified aliases for QDoc
+ using parameter_type = const T &;
+ using rvalue_ref = T &&;
+#endif
private:
void resize_internal(qsizetype i, Qt::Initialization);
diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc
index e947ee6677..a66ebfda4e 100644
--- a/src/corelib/tools/qlist.qdoc
+++ b/src/corelib/tools/qlist.qdoc
@@ -1392,8 +1392,7 @@
iterator for QList and QStack.
QList provides both \l{STL-style iterators} and \l{Java-style
- iterators}. The STL-style non-const iterator is simply a typedef
- for "T *" (pointer to T).
+ iterators}.
//! [iterator-invalidation-class-desc]
\warning Iterators on implicitly shared containers do not work
@@ -1415,8 +1414,7 @@
iterator for QList and QStack.
QList provides both \l{STL-style iterators} and \l{Java-style
- iterators}. The STL-style const iterator is simply a typedef for
- "const T *" (pointer to const T).
+ iterators}.
\include qlist.qdoc iterator-invalidation-class-desc
@@ -1429,8 +1427,6 @@
The QList::reverse_iterator typedef provides an STL-style non-const
reverse iterator for QList.
- It is simply a typedef for \c{std::reverse_iterator<T*>}.
-
\include qlist.qdoc iterator-invalidation-class-desc
\sa QList::rbegin(), QList::rend(), QList::const_reverse_iterator, QList::iterator
@@ -1442,8 +1438,6 @@
The QList::const_reverse_iterator typedef provides an STL-style const
reverse iterator for QList.
- It is simply a typedef for \c{std::reverse_iterator<const T*>}.
-
\include qlist.qdoc iterator-invalidation-class-desc
\sa QList::rbegin(), QList::rend(), QList::reverse_iterator, QList::const_iterator
@@ -1461,47 +1455,45 @@
/*! \typedef QList::const_pointer
- Typedef for const T *. Provided for STL compatibility.
+ Provided for STL compatibility.
*/
/*! \typedef QList::const_reference
- Typedef for const T &. Provided for STL compatibility.
+ Provided for STL compatibility.
*/
/*! \typedef QList::difference_type
- Typedef for ptrdiff_t. Provided for STL compatibility.
+ Provided for STL compatibility.
*/
/*! \typedef QList::pointer
- Typedef for T *. Provided for STL compatibility.
+ Provided for STL compatibility.
*/
/*! \typedef QList::reference
- Typedef for T &. Provided for STL compatibility.
+ Provided for STL compatibility.
*/
/*! \typedef QList::size_type
- Typedef for int. Provided for STL compatibility.
+ Provided for STL compatibility.
*/
/*! \typedef QList::value_type
- Typedef for T. Provided for STL compatibility.
+ Provided for STL compatibility.
*/
/*! \typedef QList::parameter_type
- Trait-dependent typedef for either const T & or T.
*/
/*! \typedef QList::rvalue_ref
- Trait-dependent typedef for T &&.
*/
/*! \fn template <typename T> QList<T> QList<T>::toList() const