diff options
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 70bbc11ad2..be987c359b 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -112,7 +112,7 @@ struct Q_CORE_EXPORT QListData { void remove(int i); void remove(int i, int n); void move(int from, int to); - inline int size() const noexcept { return d->end - d->begin; } + inline int size() const noexcept { return int(d->end - d->begin); } // q6sizetype inline bool isEmpty() const noexcept { return d->end == d->begin; } inline void **at(int i) const noexcept { return d->array + d->begin + i; } inline void **begin() const noexcept { return d->array + d->begin; } @@ -446,6 +446,13 @@ private: inline int count_impl(const T &, QListData::ArrayCompatibleLayout) const; }; +#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201606 +template <typename InputIterator, + typename ValueType = typename std::iterator_traits<InputIterator>::value_type, + QtPrivate::IfIsInputIterator<InputIterator> = true> +QList(InputIterator, InputIterator) -> QList<ValueType>; +#endif + #if defined(Q_CC_BOR) template <typename T> Q_INLINE_TEMPLATE T &QList<T>::Node::t() @@ -1044,7 +1051,7 @@ int lastIndexOf(const QList<T> &list, const U &u, int from) Node *n = reinterpret_cast<Node *>(list.p.at(from + 1)); while (n-- != b) { if (n->t() == u) - return n - b; + return typename QList<T>::difference_type(n - b); } } return -1; |