diff --git a/BAN/BAN/String.cpp b/BAN/BAN/String.cpp index 609cf69d..7c4908cf 100644 --- a/BAN/BAN/String.cpp +++ b/BAN/BAN/String.cpp @@ -48,6 +48,12 @@ namespace BAN return *this; } + String& String::operator=(StringView other) + { + MUST(copy_impl(other)); + return *this; + } + ErrorOr String::PushBack(char ch) { TRY(EnsureCapasity(m_size + 2)); @@ -70,8 +76,6 @@ namespace BAN ErrorOr String::Insert(StringView other, size_type index) { - dprintln("insert '{}' to '{}' at index {}", other, *this, index); - ASSERT(index <= m_size); TRY(EnsureCapasity(m_size + other.Size() + 1)); memmove(m_data + index + other.Size(), m_data + index, m_size - index); diff --git a/BAN/include/BAN/String.h b/BAN/include/BAN/String.h index 3ec3d6cf..c281845a 100644 --- a/BAN/include/BAN/String.h +++ b/BAN/include/BAN/String.h @@ -24,6 +24,7 @@ namespace BAN String& operator=(const String&); String& operator=(String&&); + String& operator=(StringView); [[nodiscard]] ErrorOr PushBack(char); [[nodiscard]] ErrorOr Insert(char, size_type);