diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-05-24 14:27:48 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2019-10-30 11:52:48 +0100 |
commit | 5357231c0a10eef558cc6aebfd172048dc010a96 (patch) | |
tree | 47d13d107665105bc93734c064b11e47ad5392e2 /src/corelib/tools/qvector.h | |
parent | 1299a2330ae14a6a901f574ea01fc63715e1b87d (diff) |
Make QList an alias to QVector
This is almost 100% source compatible with Qt 5. Exceptions are
* Stability of references for large or non movable types
* taking a PMF for types that are now overloaded with r-value references
in QVector
* The missing prepend optimization in QVector (that is still planned
to come for Qt 6)
Change-Id: I96d44553304dd623def9c70d6fea8fa2fb0373b0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/tools/qvector.h')
-rw-r--r-- | src/corelib/tools/qvector.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 45f7c5b76b..366eb15813 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -317,9 +317,6 @@ public: inline QVector<T> &operator<<(T &&t) { append(std::move(t)); return *this; } - static QVector<T> fromList(const QList<T> &list); - QList<T> toList() const; - #if QT_VERSION < QT_VERSION_CHECK(6,0,0) Q_DECL_DEPRECATED_X("Use QVector<T>(vector.begin(), vector.end()) instead.") static inline QVector<T> fromStdVector(const std::vector<T> &vector) @@ -328,6 +325,14 @@ public: inline std::vector<T> toStdVector() const { return std::vector<T>(d->begin(), d->end()); } #endif + + // Consider deprecating in 6.4 or later + static QVector<T> fromList(const QVector<T> &list) { return list; } + QVector<T> toList() const { return *this; } + + static inline QVector<T> fromVector(const QVector<T> &vector) { return vector; } + inline QVector<T> toVector() const { return *this; } + private: // ### Qt6: remove methods, they are unused void reallocData(const int size, const int alloc, QArrayData::AllocationOptions options = QArrayData::Default); |