From a2badac44d94294d9404224a55b3193c87cc201d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 2 Oct 2019 11:36:54 +0900 Subject: More fixes for Apple not having deduction guides in stdlib --- lib/jobs/basejob.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp index 6a70bc40..7336fc47 100644 --- a/lib/jobs/basejob.cpp +++ b/lib/jobs/basejob.cpp @@ -44,6 +44,12 @@ struct NetworkReplyDeleter : public QScopedPointerDeleteLater { } }; +template +constexpr auto make_array(Ts&&... items) +{ + return std::array, sizeof...(Ts)>({items...}); +} + class BaseJob::Private { public: struct JobTimeoutConfig { @@ -108,10 +114,10 @@ public: QString dumpRequest() const { - // Thanks to C++17, std::array's type and bounds are deduced + // FIXME: use std::array {} when Apple stdlib gets deduction guides for it static const auto verbs = - std::array { QStringLiteral("GET"), QStringLiteral("PUT"), - QStringLiteral("POST"), QStringLiteral("DELETE") }; + make_array(QStringLiteral("GET"), QStringLiteral("PUT"), + QStringLiteral("POST"), QStringLiteral("DELETE")); const auto verbWord = verbs.at(size_t(verb)); return verbWord % ' ' % (reply ? reply->url().toString(QUrl::RemoveQuery) -- cgit v1.2.3