From d6250e2a0da4901e35e8d5fe18b716ff81e06a7e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 7 Oct 2022 11:31:55 +0200 Subject: Short live q20::copy{,_n,_if}! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All they do is add constexpr. Use them in QOffsetStringArray where they replace a custom implementation, except, as usual, the custom implementation does one tiny thing more, so not all uses can be replaced. Explicitly not use it in QStaticByteArrayMatcher to not cause conflicts with the introduction of QStaticLatin1StringMatcher. Pick-to: 6.4 Change-Id: I3c102a7e934a1d7d5fae4cbc629a4fabf2c47c92 Reviewed-by: Qt CI Bot Reviewed-by: MÃ¥rten Nordheim --- src/corelib/tools/qoffsetstringarray_p.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools/qoffsetstringarray_p.h') diff --git a/src/corelib/tools/qoffsetstringarray_p.h b/src/corelib/tools/qoffsetstringarray_p.h index 93360a3925..4083487175 100644 --- a/src/corelib/tools/qoffsetstringarray_p.h +++ b/src/corelib/tools/qoffsetstringarray_p.h @@ -20,6 +20,7 @@ #include +#include #include #include #include @@ -100,7 +101,7 @@ constexpr auto makeStaticString(Extractor extract, const T &... entries) const char *strings[] = { extract(entries).operator const char *()... }; size_t lengths[] = { sizeof(extract(T{}))... }; for (size_t i = 0; i < std::size(strings); ++i) { - copyData(strings[i], lengths[i], result.begin() + offset); + q20::copy_n(strings[i], lengths[i], result.begin() + offset); offset += lengths[i]; } return result; @@ -110,7 +111,7 @@ template struct StaticString { char value[N] = {}; constexpr StaticString() = default; - constexpr StaticString(const char (&s)[N]) { copyData(s, N, value); } + constexpr StaticString(const char (&s)[N]) { q20::copy_n(s, N, value); } constexpr operator const char *() const { return value; } }; -- cgit v1.2.3