diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-09-08 17:17:17 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-09-12 23:26:12 +0000 |
commit | 4f450ddf1965a5d6220ba1460ae4514a4cad63b6 (patch) | |
tree | b49489cf44d46233ec70164fc03eed35d0b7ce51 | |
parent | 281ee04a825c4d4ba4ca88929ee572df0d1a4cfd (diff) |
Qt UDLs: avoid the deprecated form of UDL definitions
cppreference.com says¹ that the space after the "" is deprecated now,
so remove the space. Let's just hope all our compilers support this,
otherwise it will get ugly².
¹ https://en.cppreference.com/w/cpp/language/user_literal#Literal_operators
² https://github.com/yhirose/cpp-httplib/issues/953
Pick-to: 6.5 6.2
Change-Id: Ic8e4939e3ba713023c5a5c020305c96b521dbda9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5503b478935aee563d31c5df035803818f4cead3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/corelib/text/qbytearray.h | 4 | ||||
-rw-r--r-- | src/corelib/text/qchar.h | 2 | ||||
-rw-r--r-- | src/corelib/text/qlatin1stringview.h | 2 | ||||
-rw-r--r-- | src/corelib/text/qstring.h | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 972e2174d3..3b99ef78b2 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -715,7 +715,7 @@ namespace Qt { inline namespace Literals { inline namespace StringLiterals { -inline QByteArray operator"" _ba(const char *str, size_t size) noexcept +inline QByteArray operator""_ba(const char *str, size_t size) noexcept { return QByteArray(QByteArrayData(nullptr, const_cast<char *>(str), qsizetype(size))); } @@ -728,7 +728,7 @@ inline namespace QtLiterals { #if QT_DEPRECATED_SINCE(6, 8) QT_DEPRECATED_VERSION_X_6_8("Use _ba from Qt::StringLiterals namespace instead.") -inline QByteArray operator"" _qba(const char *str, size_t size) noexcept +inline QByteArray operator""_qba(const char *str, size_t size) noexcept { return Qt::StringLiterals::operator""_ba(str, size); } diff --git a/src/corelib/text/qchar.h b/src/corelib/text/qchar.h index e9f0cf3346..30a15f96a2 100644 --- a/src/corelib/text/qchar.h +++ b/src/corelib/text/qchar.h @@ -627,7 +627,7 @@ namespace Qt { inline namespace Literals { inline namespace StringLiterals { -constexpr inline QLatin1Char operator"" _L1(char ch) noexcept +constexpr inline QLatin1Char operator""_L1(char ch) noexcept { return QLatin1Char(ch); } diff --git a/src/corelib/text/qlatin1stringview.h b/src/corelib/text/qlatin1stringview.h index 257e7b3006..4a7bf357ed 100644 --- a/src/corelib/text/qlatin1stringview.h +++ b/src/corelib/text/qlatin1stringview.h @@ -352,7 +352,7 @@ namespace Qt { inline namespace Literals { inline namespace StringLiterals { -constexpr inline QLatin1StringView operator"" _L1(const char *str, size_t size) noexcept +constexpr inline QLatin1StringView operator""_L1(const char *str, size_t size) noexcept { return {str, qsizetype(size)}; } diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index b67ed099de..c00885dab2 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -1470,7 +1470,7 @@ qsizetype erase_if(QString &s, Predicate pred) namespace Qt { inline namespace Literals { inline namespace StringLiterals { -inline QString operator"" _s(const char16_t *str, size_t size) noexcept +inline QString operator""_s(const char16_t *str, size_t size) noexcept { return QString(QStringPrivate(nullptr, const_cast<char16_t *>(str), qsizetype(size))); } @@ -1483,7 +1483,7 @@ inline namespace QtLiterals { #if QT_DEPRECATED_SINCE(6, 8) QT_DEPRECATED_VERSION_X_6_8("Use _s from Qt::StringLiterals namespace instead.") -inline QString operator"" _qs(const char16_t *str, size_t size) noexcept +inline QString operator""_qs(const char16_t *str, size_t size) noexcept { return Qt::StringLiterals::operator""_s(str, size); } |