diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qlist.cpp | 68 | ||||
-rw-r--r-- | src/corelib/tools/qoffsetstringarray_p.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qset.qdoc | 55 | ||||
-rw-r--r-- | src/corelib/tools/qsimd.cpp | 22 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 2 |
5 files changed, 105 insertions, 43 deletions
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 5d5da20752..f0b92b5206 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -2017,7 +2017,7 @@ void **QListData::erase(void **xi) \include containers-range-constructor.qdocinc - \sa fromSet(), toVector(), QVector::toList() + \sa toVector(), QVector::toList() */ /*! \fn template <class T> QVector<T> QList<T>::toVector() const @@ -2030,61 +2030,91 @@ void **QListData::erase(void **xi) \include containers-range-constructor.qdocinc - \sa toSet(), fromVector(), QVector::fromList() + \sa fromVector(), QVector::fromList() */ /*! \fn template <class T> QList<T> QList<T>::fromSet(const QSet<T> &set) + \obsolete Returns a QList object with the data contained in \a set. The order of the elements in the QList is undefined. - Example: - - \snippet code/src_corelib_tools_qlistdata.cpp 23 - \include containers-range-constructor.qdocinc - \sa fromVector(), toSet(), QSet::toList() + \oldcode + QSet<int> set; + // ... + QList<int> list = QList<int>::fromSet(set); + \newcode + QSet<int> set; + // ... + QList<int> list(set.begin(), set.end()); + \endcode + + \sa QList(InputIterator, InputIterator), fromVector(), toSet(), QSet::toList() */ /*! \fn template <class T> QSet<T> QList<T>::toSet() const + \obsolete Returns a QSet object with the data contained in this QList. Since QSet doesn't allow duplicates, the resulting QSet might be smaller than the original list was. - Example: - - \snippet code/src_corelib_tools_qlistdata.cpp 24 - \include containers-range-constructor.qdocinc - \sa toVector(), fromSet(), QSet::fromList() + \oldcode + QStringList list; + // ... + QSet<QString> set = list.toSet(); + \newcode + QStringList list; + // ... + QSet<QString> set(list.begin(), list.end()); + \endcode + + \sa QSet::QSet(InputIterator, InputIterator), toVector(), fromSet(), QSet::fromList() */ /*! \fn template <class T> QList<T> QList<T>::fromStdList(const std::list<T> &list) + \obsolete Returns a QList object with the data contained in \a list. The order of the elements in the QList is the same as in \a list. - Example: - - \snippet code/src_corelib_tools_qlistdata.cpp 25 - \include containers-range-constructor.qdocinc - \sa toStdList(), QVector::fromStdVector() + \oldcode + std::list<double> stdlist; + // ... + QList<double> list = QList<double>::fromStdList(stdlist); + \newcode + std::list<double> stdlist; + // ... + QList<double> list(stdlist.begin(), stdlist.end()); + \endcode + + \sa QList(InputIterator, InputIterator), toStdList(), QVector::fromStdVector() */ /*! \fn template <class T> std::list<T> QList<T>::toStdList() const + \obsolete Returns a std::list object with the data contained in this QList. Example: - \snippet code/src_corelib_tools_qlistdata.cpp 26 - \include containers-range-constructor.qdocinc + \oldcode + QList<double> list; + // ... + std::list<double> stdlist = list.toStdList(); + \newcode + QList<double> list; + // ... + std::list<double> stdlist(list.begin(), list.end()); + \endcode + \sa fromStdList(), QVector::toStdVector() */ diff --git a/src/corelib/tools/qoffsetstringarray_p.h b/src/corelib/tools/qoffsetstringarray_p.h index 4dd9e9603b..e26a57ff43 100644 --- a/src/corelib/tools/qoffsetstringarray_p.h +++ b/src/corelib/tools/qoffsetstringarray_p.h @@ -55,6 +55,7 @@ #include <tuple> #include <array> +#include <limits> QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index 42dd1288ac..dcd6de3d5c 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -1071,17 +1071,32 @@ */ /*! \fn template <class T> QList<T> QSet<T>::toList() const + \obsolete Returns a new QList containing the elements in the set. The order of the elements in the QList is undefined. - Example: + \include containers-range-constructor.qdocinc - \snippet code/doc_src_qset.cpp 13 + \oldcode + QSet<QString> set; + // ... + QList<QString> list = set.toList(); + \newcode + QSet<QString> set; + // ... + QList<QString> list(set.begin(), set.end()); + \endcode - \include containers-range-constructor.qdocinc + or - \sa fromList(), QList::fromSet() + \code + QSet<QString> set; + // ... + QList<QString> list = set.values(); + \endcode + + \sa QList::QList(InputIterator, InputIterator), values(), fromList(), QList::fromSet() */ /*! \fn template <class T> QList<T> QSet<T>::values() const @@ -1089,28 +1104,44 @@ Returns a new QList containing the elements in the set. The order of the elements in the QList is undefined. - This is the same as toList(). - \include containers-range-constructor.qdocinc - \sa fromList(), QList::fromSet() + \oldcode + QSet<QString> set; + // ... + QList<QString> list = set.values(); + \newcode + QSet<QString> set; + // ... + QList<QString> list(set.begin(), set.end()); + \endcode + + + \sa QList::QList(InputIterator, InputIterator) */ /*! \fn template <class T> QSet<T> QSet<T>::fromList(const QList<T> &list) + \obsolete Returns a new QSet object containing the data contained in \a list. Since QSet doesn't allow duplicates, the resulting QSet might be smaller than the \a list, because QList can contain duplicates. - Example: - - \snippet code/doc_src_qset.cpp 14 - \include containers-range-constructor.qdocinc - \sa toList(), QList::toSet() + \oldcode + QStringList list; + // ... + QSet<QString> set = QSet<QString>::fromList(list); + \newcode + QStringList list; + // ... + QSet<QString> set(list.begin(), list.end()); + \endcode + + \sa QSet(InputIterator, InputIterator), values(), QList::toSet() */ /*! diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 6ad6795fec..798ac93ad2 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -132,7 +132,7 @@ static inline quint64 detectProcessorFeatures() #if defined(Q_OS_LINUX) # if defined(Q_PROCESSOR_ARM_V8) && defined(Q_PROCESSOR_ARM_64) - features |= Q_UINT64_C(1) << CpuFeatureNEON; // NEON is always available on ARMv8 64bit. + features |= CpuFeatureNEON; // NEON is always available on ARMv8 64bit. # endif int auxv = qt_safe_open("/proc/self/auxv", O_RDONLY); if (auxv != -1) { @@ -151,17 +151,17 @@ static inline quint64 detectProcessorFeatures() # if defined(Q_PROCESSOR_ARM_V8) && defined(Q_PROCESSOR_ARM_64) // For Aarch64: if (vector[i+1] & HWCAP_CRC32) - features |= Q_UINT64_C(1) << CpuFeatureCRC32; + features |= CpuFeatureCRC32; # endif // Aarch32, or ARMv7 or before: if (vector[i+1] & HWCAP_NEON) - features |= Q_UINT64_C(1) << CpuFeatureNEON; + features |= CpuFeatureNEON; } # if defined(Q_PROCESSOR_ARM_32) // For Aarch32: if (vector[i] == AT_HWCAP2) { if (vector[i+1] & HWCAP2_CRC32) - features |= Q_UINT64_C(1) << CpuFeatureCRC32; + features |= CpuFeatureCRC32; } # endif } @@ -174,10 +174,10 @@ static inline quint64 detectProcessorFeatures() #endif #if defined(__ARM_NEON__) - features |= Q_UINT64_C(1) << CpuFeatureNEON; + features |= CpuFeatureNEON; #endif #if defined(__ARM_FEATURE_CRC32) - features |= Q_UINT64_C(1) << CpuFeatureCRC32; + features |= CpuFeatureCRC32; #endif return features; @@ -505,18 +505,18 @@ static inline quint64 detectProcessorFeatures() quint64 flags = 0; #if defined __mips_dsp - flags |= Q_UINT64_C(1) << CpuFeatureDSP; + flags |= CpuFeatureDSP; # if defined __mips_dsp_rev && __mips_dsp_rev >= 2 - flags |= Q_UINT64_C(1) << CpuFeatureDSPR2; + flags |= CpuFeatureDSPR2; # elif defined(Q_OS_LINUX) if (procCpuinfoContains("cpu model", "MIPS 74Kc") || procCpuinfoContains("cpu model", "MIPS 74Kf")) - flags |= Q_UINT64_C(1) << CpuFeatureDSPR2; + flags |= CpuFeatureDSPR2; # endif #elif defined(Q_OS_LINUX) if (procCpuinfoContains("ASEs implemented", "dsp")) { - flags |= Q_UINT64_C(1) << CpuFeatureDSP; + flags |= CpuFeatureDSP; if (procCpuinfoContains("cpu model", "MIPS 74Kc") || procCpuinfoContains("cpu model", "MIPS 74Kf")) - flags |= Q_UINT64_C(1) << CpuFeatureDSPR2; + flags |= CpuFeatureDSPR2; } #endif diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index d61c26dc2e..6acbf3561e 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -523,7 +523,7 @@ QVector<T>::QVector(int asize, const T &t) d = Data::allocate(asize); Q_CHECK_PTR(d); d->size = asize; - T* i = d->end(); + auto i = d->end(); while (i != d->begin()) new (--i) T(t); } else { |