From 99f8efd0ef15ed4d0692d5de04855958df014fb2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 27 Aug 2024 08:40:25 +0200 Subject: [PATCH] QStringTokenizer: clean up Q_STRINGTOKENIZER_USE_SENTINEL The macro was unconditionally defined since 44a74127954dce2416842a6644cbdff4c513b6fb and, despite being named like a public Qt macro, never documented, so just remove it. Also means we can remove the ODR protection from end() and cend() now. [ChangeLog][Potentially Source-Incompatible Changes] The undocumented Q_STRINGTOKENIZER_USE_SENTINEL macro was removed. It was unconditionally defined since Qt 6.0. Change-Id: I8ba2aeddea79ad89cef8912e9cf34098f2793f1b Reviewed-by: Thiago Macieira (cherry picked from commit 799e16149ce9d34419da9ea35f790412202ce7a8) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qstringtokenizer.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/corelib/text/qstringtokenizer.h b/src/corelib/text/qstringtokenizer.h index 7a627b45084..959462533b7 100644 --- a/src/corelib/text/qstringtokenizer.h +++ b/src/corelib/text/qstringtokenizer.h @@ -11,8 +11,6 @@ QT_BEGIN_NAMESPACE template class QStringBuilder; -#define Q_STRINGTOKENIZER_USE_SENTINEL - class QStringTokenizerBaseBase { protected: @@ -48,14 +46,10 @@ public: class iterator; friend class iterator; -#ifdef Q_STRINGTOKENIZER_USE_SENTINEL class sentinel { friend constexpr bool operator==(sentinel, sentinel) noexcept { return true; } friend constexpr bool operator!=(sentinel, sentinel) noexcept { return false; } }; -#else - using sentinel = iterator; -#endif class iterator { const QStringTokenizerBase *tokenizer; next_result current; @@ -82,7 +76,6 @@ public: { 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); } -#ifdef Q_STRINGTOKENIZER_USE_SENTINEL friend constexpr bool operator==(const iterator &lhs, sentinel) noexcept { return !lhs.current.ok; } friend constexpr bool operator!=(const iterator &lhs, sentinel) noexcept @@ -91,7 +84,6 @@ public: { return !rhs.current.ok; } friend constexpr bool operator!=(sentinel, const iterator &rhs) noexcept { return !operator==(sentinel{}, rhs); } -#endif private: void advance() { Q_ASSERT(current.ok); @@ -110,9 +102,7 @@ public: [[nodiscard]] iterator begin() const noexcept { return iterator{*this}; } [[nodiscard]] iterator cbegin() const noexcept { return begin(); } - template ::value> // ODR protection [[nodiscard]] constexpr sentinel end() const noexcept { return {}; } - template ::value> // ODR protection [[nodiscard]] constexpr sentinel cend() const noexcept { return {}; } private: