From e1654aeb2e7fa282af045496c4903b06d2893e21 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 21 Jan 2022 14:29:27 +0100 Subject: [PATCH] QStaticByteArrayMatcher: add a useful comment Took me a few seconds to figure this out, and I'm the author of the class, so leave a comment for my future self (and anyone else). Pick-to: 6.3 6.2 5.15 Change-Id: I65a7aa6f8abf9d671f7d9ba45400f19e0f46728f Reviewed-by: Edward Welbourne --- src/corelib/text/qbytearraymatcher.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/text/qbytearraymatcher.h b/src/corelib/text/qbytearraymatcher.h index d9ea638500..2a65a257ee 100644 --- a/src/corelib/text/qbytearraymatcher.h +++ b/src/corelib/text/qbytearraymatcher.h @@ -147,6 +147,7 @@ template class QStaticByteArrayMatcher : QStaticByteArrayMatcherBase { char m_pattern[N]; + // N includes the terminating '\0'! static_assert(N > 2, "QStaticByteArrayMatcher makes no sense for finding a single-char pattern"); public: explicit constexpr QStaticByteArrayMatcher(const char (&patternToMatch)[N]) noexcept