diff --git a/luna/include/luna/OwnedStringView.h b/luna/include/luna/OwnedStringView.h index b5ce7622..8a47b597 100644 --- a/luna/include/luna/OwnedStringView.h +++ b/luna/include/luna/OwnedStringView.h @@ -22,11 +22,7 @@ class OwnedStringView return m_length; } - const char& operator[](usize index) const - { - expect(index < m_length, "OwnedStringView: index out of range"); - return m_string[index]; - } + const char& operator[](usize) const; private: char* m_string{nullptr}; diff --git a/luna/src/OwnedStringView.cpp b/luna/src/OwnedStringView.cpp index 8ac2df4b..80e42fa7 100644 --- a/luna/src/OwnedStringView.cpp +++ b/luna/src/OwnedStringView.cpp @@ -33,4 +33,10 @@ Result OwnedStringView::clone() const if (!c_str) return err(ENOMEM); return OwnedStringView{c_str}; +} + +const char& OwnedStringView::operator[](usize index) const +{ + expect(index < m_length, "index out of range"); + return m_string[index]; } \ No newline at end of file