From e0d93ed4908391c156f5f0f91eaef67f730f59bd Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 27 Aug 2024 08:40:25 +0200 Subject: [PATCH] QStringTokenizer: remove unused op==(it, it) Its presence is a remnant of a time (Qt 5) when QStringTokenizer::sentinel could optionally be QStringTokenizer::iterator (for pre-C++17 code). Remove, since it a) compiles bad user code, b) acts as a bad c'n'p source for others and c) removes a nasty Q_ASSERT()-in-noexcept. [ChangeLog][Potentially Source-Incompatible Changes] The relational operators between QStringTokenizer::iterators have been removed. Correct code didn't need them since Qt 6.0, when QStringTokenizer::end() started returning ::sentinel instead of ::iterator unconditionally. You can still compare iterator and sentinel, just not iterator and iterator. Change-Id: I83d1dcac98b52526dabc6327cfd93956afd24e97 Reviewed-by: Thiago Macieira --- src/corelib/text/qstringtokenizer.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/corelib/text/qstringtokenizer.h b/src/corelib/text/qstringtokenizer.h index 959462533b7..532724306ee 100644 --- a/src/corelib/text/qstringtokenizer.h +++ b/src/corelib/text/qstringtokenizer.h @@ -72,10 +72,6 @@ public: iterator& operator++() { advance(); return *this; } iterator operator++(int) { auto tmp = *this; advance(); return tmp; } - friend constexpr bool operator==(const iterator &lhs, const iterator &rhs) noexcept - { return lhs.current.ok == rhs.current.ok && (!lhs.current.ok || (Q_ASSERT(lhs.tokenizer == rhs.tokenizer), lhs.current.state == rhs.current.state)); } - friend constexpr bool operator!=(const iterator &lhs, const iterator &rhs) noexcept - { return !operator==(lhs, rhs); } friend constexpr bool operator==(const iterator &lhs, sentinel) noexcept { return !lhs.current.ok; } friend constexpr bool operator!=(const iterator &lhs, sentinel) noexcept