#include #include #include OwnedStringView::OwnedStringView() { } OwnedStringView::OwnedStringView(OwnedStringView&& other) { m_string = other.m_string; m_length = other.m_length; other.m_string = nullptr; } OwnedStringView::OwnedStringView(char* c_str) { m_string = c_str; if (m_string) { m_length = strlen(m_string); } } OwnedStringView::~OwnedStringView() { if (m_string) destroy_array(m_string); } Result OwnedStringView::clone() { char* buf = TRY(make_array(m_length + 1)); memcpy(buf, m_string, m_length + 1); return OwnedStringView{buf}; }