QPluginMetaData: replace manual loop with q20::copy_n

Change-Id: I7061b18efd2ff905cc36df41d680c0612a505a76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9bd287335b2b7a70e116f4ef955e9e12df9009d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-10-07 23:13:17 +02:00 committed by Qt Cherry-pick Bot
parent 1cbae2adcb
commit dcd2735dca

View File

@ -9,6 +9,8 @@
#include <QtCore/qpointer.h> #include <QtCore/qpointer.h>
#include <QtCore/qjsonobject.h> #include <QtCore/qjsonobject.h>
#include <QtCore/q20algorithm.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// Used up to Qt 6.2 // Used up to Qt 6.2
@ -38,10 +40,8 @@ struct QPluginMetaData
template <size_t OSize, typename OO, size_t ISize, typename II> template <size_t OSize, typename OO, size_t ISize, typename II>
static constexpr void copy(OO (&out)[OSize], II (&in)[ISize]) static constexpr void copy(OO (&out)[OSize], II (&in)[ISize])
{ {
// std::copy is not constexpr until C++20
static_assert(OSize <= ISize, "Output would not be fully initialized"); static_assert(OSize <= ISize, "Output would not be fully initialized");
for (size_t i = 0; i < OSize; ++i) q20::copy_n(in, OSize, out);
out[i] = in[i];
} }
static constexpr quint8 archRequirements() static constexpr quint8 archRequirements()