diff --git a/AK/FlyString.cpp b/AK/FlyString.cpp index d1b31e14497..5ad1725d3ab 100644 --- a/AK/FlyString.cpp +++ b/AK/FlyString.cpp @@ -115,11 +115,6 @@ FlyString FlyString::to_lowercase() const return String(*m_impl).to_lowercase(); } -StringView FlyString::view() const -{ - return { characters(), length() }; -} - bool FlyString::operator==(const String& other) const { if (m_impl == other.impl()) diff --git a/AK/FlyString.h b/AK/FlyString.h index 778d448b3d3..26131678495 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -60,8 +60,7 @@ public: size_t length() const { return m_impl ? m_impl->length() : 0; } ALWAYS_INLINE u32 hash() const { return m_impl ? m_impl->existing_hash() : 0; } - - StringView view() const; + ALWAYS_INLINE StringView view() const { return m_impl ? m_impl->view() : StringView {}; } FlyString to_lowercase() const; diff --git a/AK/StringImpl.h b/AK/StringImpl.h index 316321ef5d9..e84fa014329 100644 --- a/AK/StringImpl.h +++ b/AK/StringImpl.h @@ -43,6 +43,7 @@ public: const char* characters() const { return &m_inline_buffer[0]; } ALWAYS_INLINE ReadonlyBytes bytes() const { return { characters(), length() }; } + ALWAYS_INLINE StringView view() const { return { characters(), length() }; } const char& operator[](size_t i) const {