diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 11:31:55 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 18:10:56 +0200 |
commit | d6250e2a0da4901e35e8d5fe18b716ff81e06a7e (patch) | |
tree | 4b120d01125fe212f4abf6a629911e4c65ed0d9c /src/corelib/tools/qoffsetstringarray_p.h | |
parent | e17372e723555cd9eb7b4efcb553812e0b98f37b (diff) |
Short live q20::copy{,_n,_if}!
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 <qt_ci_bot@qt-project.org>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/tools/qoffsetstringarray_p.h')
-rw-r--r-- | src/corelib/tools/qoffsetstringarray_p.h | 5 |
1 files changed, 3 insertions, 2 deletions
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 <QByteArrayView> +#include <QtCore/q20algorithm.h> #include <array> #include <limits> #include <string_view> @@ -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 <size_t N> 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; } }; |