summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvector.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-10-08 11:55:13 +0200
committerLars Knoll <lars.knoll@qt.io>2018-12-03 17:57:03 +0000
commit972f8845a85d6a07140025e4257cb8a1a2699b5d (patch)
tree09c393bcbd6f38256e54cd4bd0b7f90e4029ec33 /src/corelib/tools/qvector.h
parent4b1ce72c232b21fb1a8ae8ca86c2b8a7bc00b993 (diff)
Invert include dependencies between QList and QVector
This is a very slight source incompatibility, but required as a preparation for Qt 6, where QList should inherit QVector or share the implementation with it. This requires some special work to correctly instantiate and export QVector<QPoint> from Qt Core on MSVC. Change-Id: I1d042c5fafdde7afe59409eda2580871d4832fcd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qvector.h')
-rw-r--r--src/corelib/tools/qvector.h46
1 files changed, 3 insertions, 43 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 30fd7b2865..778bcb3745 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -42,7 +42,6 @@
#include <QtCore/qalgorithms.h>
#include <QtCore/qiterator.h>
-#include <QtCore/qlist.h>
#include <QtCore/qrefcount.h>
#include <QtCore/qarraydata.h>
#include <QtCore/qhashfunctions.h>
@@ -968,37 +967,6 @@ Q_OUTOFLINE_TEMPLATE QVector<T> QVector<T>::mid(int pos, int len) const
return midResult;
}
-template <typename T>
-Q_OUTOFLINE_TEMPLATE QList<T> QVector<T>::toList() const
-{
- QList<T> result;
- result.reserve(size());
- for (int i = 0; i < size(); ++i)
- result.append(at(i));
- return result;
-}
-
-template <typename T>
-Q_OUTOFLINE_TEMPLATE QVector<T> QList<T>::toVector() const
-{
- QVector<T> result(size());
- for (int i = 0; i < size(); ++i)
- result[i] = at(i);
- return result;
-}
-
-template <typename T>
-QVector<T> QVector<T>::fromList(const QList<T> &list)
-{
- return list.toVector();
-}
-
-template <typename T>
-QList<T> QList<T>::fromVector(const QVector<T> &vector)
-{
- return vector.toList();
-}
-
Q_DECLARE_SEQUENTIAL_ITERATOR(Vector)
Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(Vector)
@@ -1046,20 +1014,12 @@ inline bool operator>=(const QVector<T> &lhs, const QVector<T> &rhs)
### QVector<QPointF> respectively.
*/
-#ifdef Q_CC_MSVC
+#if defined(Q_CC_MSVC) && !defined(QT_BUILD_CORE_LIB)
QT_BEGIN_INCLUDE_NAMESPACE
#include <QtCore/qpoint.h>
QT_END_INCLUDE_NAMESPACE
-
-#ifndef Q_TEMPLATE_EXTERN
-#if defined(QT_BUILD_CORE_LIB)
-#define Q_TEMPLATE_EXTERN
-#else
-#define Q_TEMPLATE_EXTERN extern
-#endif
-#endif
-Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPointF>;
-Q_TEMPLATE_EXTERN template class Q_CORE_EXPORT QVector<QPoint>;
+extern template class Q_CORE_EXPORT QVector<QPointF>;
+extern template class Q_CORE_EXPORT QVector<QPoint>;
#endif
QVector<uint> QStringView::toUcs4() const { return QtPrivate::convertToUcs4(*this); }