QUtf8StringView: make data() constexpr

The cast that prevented it was a remnant of QStringView (which, like
QString itself, stores char16_t, but interfaces in QChar).

Remove the cast, add the constexpr.

[ChangeLog][QtCore][QUtf8StringView] data() is now constexpr, too.

Change-Id: I7891b89bf26176484411b4388ded04e56651b607
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
bb10
Marc Mutz 2023-12-04 09:42:25 +01:00
parent fe98cf4135
commit 25d1db424e
1 changed files with 1 additions and 1 deletions

View File

@ -202,7 +202,7 @@ public:
[[nodiscard]] inline QString toString() const; // defined in qstring.h
[[nodiscard]] constexpr qsizetype size() const noexcept { return m_size; }
[[nodiscard]] const_pointer data() const noexcept { return reinterpret_cast<const_pointer>(m_data); }
[[nodiscard]] constexpr const_pointer data() const noexcept { return m_data; }
#ifdef __cpp_char8_t
[[nodiscard]] const char8_t *utf8() const noexcept { return reinterpret_cast<const char8_t*>(m_data); }
#endif