Move OwnedStringView::operator[] out of line
This commit is contained in:
parent
59765aa334
commit
da39ba33a9
@ -22,11 +22,7 @@ class OwnedStringView
|
|||||||
return m_length;
|
return m_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char& operator[](usize index) const
|
const char& operator[](usize) const;
|
||||||
{
|
|
||||||
expect(index < m_length, "OwnedStringView: index out of range");
|
|
||||||
return m_string[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char* m_string{nullptr};
|
char* m_string{nullptr};
|
||||||
|
@ -33,4 +33,10 @@ Result<OwnedStringView> OwnedStringView::clone() const
|
|||||||
if (!c_str) return err(ENOMEM);
|
if (!c_str) return err(ENOMEM);
|
||||||
|
|
||||||
return OwnedStringView{c_str};
|
return OwnedStringView{c_str};
|
||||||
|
}
|
||||||
|
|
||||||
|
const char& OwnedStringView::operator[](usize index) const
|
||||||
|
{
|
||||||
|
expect(index < m_length, "index out of range");
|
||||||
|
return m_string[index];
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user