diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-11-27 06:39:59 +0100 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@qt.io> | 2024-03-01 09:41:11 +0200 |
commit | f9474364ee7ad3209873530b786bc6c081e1e2c9 (patch) | |
tree | 74c4376de9ad0de3af120436161a8ca1e57c272c /src/corelib/text/qbytearrayview.h | |
parent | aadf1d447cd07a961539c6ab607ca65c3297622a (diff) |
QByteArrayView: make conversion to string_view constexpr
Both QByteArrayView and std::string_view are Literal Types, so the
conversion between them should be constexpr.
Amends 96d67da420697cee10bdc537a1a592f6f22e2b8f.
Found in API-review.
Pick-to: 6.7
Change-Id: Ic513ce32aa2a743ca890dc05a683a62c0f3a7d50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearrayview.h')
-rw-r--r-- | src/corelib/text/qbytearrayview.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qbytearrayview.h b/src/corelib/text/qbytearrayview.h index a80ef6797d..92c38e5ed4 100644 --- a/src/corelib/text/qbytearrayview.h +++ b/src/corelib/text/qbytearrayview.h @@ -303,7 +303,7 @@ public: [[nodiscard]] constexpr char front() const { Q_ASSERT(!empty()); return m_data[0]; } [[nodiscard]] constexpr char back() const { Q_ASSERT(!empty()); return m_data[m_size - 1]; } - [[nodiscard]] Q_IMPLICIT operator std::string_view() const noexcept + [[nodiscard]] constexpr Q_IMPLICIT operator std::string_view() const noexcept { return std::string_view(m_data, size_t(m_size)); } // |