summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstringview.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/text/qstringview.h')
-rw-r--r--src/corelib/text/qstringview.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index 6a1806d602..05e5ec3fdb 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -220,15 +220,15 @@ public:
}
[[nodiscard]] constexpr QStringView first(qsizetype n) const noexcept
- { verify(0, n); return QStringView(m_data, n); }
+ { verify(0, n); return sliced(0, n); }
[[nodiscard]] constexpr QStringView last(qsizetype n) const noexcept
- { verify(0, n); return QStringView(m_data + size() - n, n); }
+ { verify(0, n); return sliced(size() - n, n); }
[[nodiscard]] constexpr QStringView sliced(qsizetype pos) const noexcept
{ verify(pos, 0); return QStringView(m_data + pos, size() - pos); }
[[nodiscard]] constexpr QStringView sliced(qsizetype pos, qsizetype n) const noexcept
{ verify(pos, n); return QStringView(m_data + pos, n); }
[[nodiscard]] constexpr QStringView chopped(qsizetype n) const noexcept
- { verify(0, n); return QStringView(m_data, m_size - n); }
+ { verify(0, n); return sliced(0, m_size - n); }
constexpr void truncate(qsizetype n) noexcept
{ verify(0, n); ; m_size = n; }