diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 06c6f668c4..31d19f7fe6 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -1436,6 +1436,13 @@ inline QString &&asString(QString &&s) { return std::move(s); } static_cast(static_cast(QtPrivate::asString(string).utf16())) #endif +// +// QStringView::QStringView(const QString &) implementation +// + +inline QStringView::QStringView(const QString &str) noexcept + : QStringView(str.isNull() ? nullptr : str.data(), qsizetype(str.size())) {} + // // QStringView::arg() implementation // diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h index 05e5ec3fdb..d62dd71bdf 100644 --- a/src/corelib/text/qstringview.h +++ b/src/corelib/text/qstringview.h @@ -96,9 +96,6 @@ private: template using if_compatible_pointer = typename std::enable_if::value, bool>::type; - template - using if_compatible_qstring_like = typename std::enable_if::value, bool>::type; - template using if_compatible_container = typename std::enable_if::value, bool>::type; @@ -155,13 +152,7 @@ public: : QStringView(str, str ? lengthHelperPointer(str) : 0) {} #endif -#ifdef Q_QDOC - QStringView(const QString &str) noexcept; -#else - template = true> - QStringView(const String &str) noexcept - : QStringView(str.isNull() ? nullptr : str.data(), qsizetype(str.size())) {} -#endif + inline QStringView(const QString &str) noexcept; template = true> constexpr Q_ALWAYS_INLINE QStringView(const Container &c) noexcept