summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2020-03-11 09:41:56 +0100
committerMarc Mutz <marc.mutz@kdab.com>2020-03-12 09:44:59 +0100
commit12b4ce72815fc1ea272da729eeb3713a9d5a4089 (patch)
tree1648741de8b0146a59d3440274200b5784630354 /src/corelib
parent0ae6803d3956cf59801bbcc52143b95de9fc96d1 (diff)
QStringView: adapt to C++20 constexpr std::basic_string
Just mark the constructor constexpr. If std::basic_string isn't, then this will be silently dropped. If std::basic_string is, we can now construct QStringView from std::basic_strings at compile-time. [ChangeLog][QtCore][QStringView] Conversion from std::basic_string can now be constexpr (when std::basic_string is). Change-Id: Ia608f1a71c9a24f417b3e21e150ff6bd3d2f4fc4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/text/qstringview.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index 83418970a5..a2e55f5b16 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -211,7 +211,7 @@ public:
#endif
template <typename StdBasicString, if_compatible_string<StdBasicString> = true>
- QStringView(const StdBasicString &str) noexcept
+ Q_DECL_CONSTEXPR QStringView(const StdBasicString &str) noexcept
: QStringView(str.data(), qsizetype(str.size())) {}
Q_REQUIRED_RESULT inline QString toString() const; // defined in qstring.h