QJniArray: fix prototype of member functions

Remove the redundant template parameter. As a drive-by, swap
pointer members using qt_ptr_swap instead of std::swap.

Found during header review.

Task-number: QTBUG-119952
Change-Id: Ibed9c7e7866672401b9dd87ff6e33db8f61e7282
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 3fd49e95a9db3f4c6805c7fcf85fbebe1d6463d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2024-01-22 13:34:48 +01:00 committed by Qt Cherry-pick Bot
parent 4f4ffa8a67
commit 64a5370817

View File

@ -24,11 +24,11 @@ struct QJniArrayIterator
constexpr QJniArrayIterator &operator=(const QJniArrayIterator &other) noexcept = default; constexpr QJniArrayIterator &operator=(const QJniArrayIterator &other) noexcept = default;
constexpr QJniArrayIterator &operator=(QJniArrayIterator &&other) noexcept = default; constexpr QJniArrayIterator &operator=(QJniArrayIterator &&other) noexcept = default;
friend bool operator==(const QJniArrayIterator<T> &lhs, const QJniArrayIterator<T> &rhs) noexcept friend bool operator==(const QJniArrayIterator &lhs, const QJniArrayIterator &rhs) noexcept
{ {
return lhs.m_array == rhs.m_array && lhs.m_index == rhs.m_index; return lhs.m_array == rhs.m_array && lhs.m_index == rhs.m_index;
} }
friend bool operator!=(const QJniArrayIterator<T> &lhs, const QJniArrayIterator<T> &rhs) noexcept friend bool operator!=(const QJniArrayIterator &lhs, const QJniArrayIterator &rhs) noexcept
{ {
return !(lhs == rhs); return !(lhs == rhs);
} }
@ -36,16 +36,16 @@ struct QJniArrayIterator
{ {
return m_array->at(m_index); return m_array->at(m_index);
} }
friend QJniArrayIterator<T> &operator++(QJniArrayIterator<T> &that) noexcept friend QJniArrayIterator &operator++(QJniArrayIterator &that) noexcept
{ {
++that.m_index; ++that.m_index;
return that; return that;
} }
void swap(QJniArrayIterator<T> &other) noexcept void swap(QJniArrayIterator &other) noexcept
{ {
std::swap(m_index, other.m_index); std::swap(m_index, other.m_index);
std::swap(m_array, other.m_array); qt_ptr_swap(m_array, other.m_array);
} }
private: private: