diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qlist.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 5d6cf9fe15..57e67d52d7 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -379,6 +379,8 @@ private: } private: + inline bool op_eq_impl(const QList &other, QListData::NotArrayCompatibleLayout) const; + inline bool op_eq_impl(const QList &other, QListData::ArrayCompatibleLayout) const; inline bool contains_impl(const T &, QListData::NotArrayCompatibleLayout) const; inline bool contains_impl(const T &, QListData::ArrayCompatibleLayout) const; inline int count_impl(const T &, QListData::NotArrayCompatibleLayout) const; @@ -796,6 +798,12 @@ Q_OUTOFLINE_TEMPLATE bool QList<T>::operator==(const QList<T> &l) const return true; if (p.size() != l.p.size()) return false; + return this->op_eq_impl(l, MemoryLayout()); +} + +template <typename T> +inline bool QList<T>::op_eq_impl(const QList &l, QListData::NotArrayCompatibleLayout) const +{ Node *i = reinterpret_cast<Node *>(p.begin()); Node *e = reinterpret_cast<Node *>(p.end()); Node *li = reinterpret_cast<Node *>(l.p.begin()); @@ -807,6 +815,15 @@ Q_OUTOFLINE_TEMPLATE bool QList<T>::operator==(const QList<T> &l) const } template <typename T> +inline bool QList<T>::op_eq_impl(const QList &l, QListData::ArrayCompatibleLayout) const +{ + const T *lb = reinterpret_cast<const T*>(l.p.begin()); + const T *b = reinterpret_cast<const T*>(p.begin()); + const T *e = reinterpret_cast<const T*>(p.end()); + return std::equal(b, e, lb); +} + +template <typename T> Q_OUTOFLINE_TEMPLATE void QList<T>::dealloc(QListData::Data *data) { node_destruct(reinterpret_cast<Node *>(data->array + data->begin), |