diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-06-27 11:14:32 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-07-06 21:31:25 +0200 |
commit | 792cb3989af2918f6a2878c22db51a009310756f (patch) | |
tree | 463b61ee3fc5deea2eb58fc8ecb30f8a5638ae74 /src/corelib/tools/qlist.qdoc | |
parent | 9a9a1a2a2e0c8bcbbaa178be3d67add3876df9b7 (diff) |
Add support for first(n), last(n) and sliced() to QList
This keeps the API symmetric with what we have in our string
classes.
Change-Id: I94c5b39b718ca2472f9ca645e7a42e4314636f67
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qlist.qdoc')
-rw-r--r-- | src/corelib/tools/qlist.qdoc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc index 550663ed0e..047c418469 100644 --- a/src/corelib/tools/qlist.qdoc +++ b/src/corelib/tools/qlist.qdoc @@ -202,6 +202,55 @@ are included. */ +/*! + \fn template <typename T> QList<T> QList<T>::first(qsizetype n) const + \since 6.0 + + Returns a sub-list that contains the first \a n elements + of this list. + + \note The behavior is undefined when \a n < 0 or \a n > size(). + + \sa last(), sliced() +*/ + +/*! + \fn template <typename T> QList<T> QList<T>::last(qsizetype n) const + \since 6.0 + + Returns a sub-list that contains the last \a n elements of this list. + + \note The behavior is undefined when \a n < 0 or \a n > size(). + + \sa first(), sliced() +*/ + +/*! + \fn template <typename T> QList<T> QList<T>::sliced(qsizetype pos, qsizetype n) const + \since 6.0 + + Returns a sub-list that contains \a n elements of this list, + starting at position \a pos. + + \note The behavior is undefined when \a pos < 0, \a n < 0, + or \a pos + \a n > size(). + + \sa first(), last() +*/ + +/*! + \fn template <typename T> QList<T> QList<T>::sliced(qsizetype pos) const + \since 6.0 + \overload + + Returns a sub-list that contains the elements of this list starting at + position \a pos and extending to its end. + + \note The behavior is undefined when \a pos < 0 or \a pos > size(). + + \sa first(), last() +*/ + /*! \fn template <typename T> QList<T>::QList() |