Optimize string single character append

Now uses a specialized implementation instead of the append multiple
characters implementation. Useful for appending single characters to
string streams (ex. newline).
This commit is contained in:
Myles Busig 2024-03-21 20:35:22 -06:00
parent 8e58ff710d
commit 6d5c083616

View File

@ -255,7 +255,12 @@ istring& istring::operator+=(const string_view& str) {
}
istring& istring::operator+=(char ch) {
return append(1, ch);
if (m_size < m_capacity) {
m_str[m_size] = ch;
++m_size;
}
return *this;
}
istring& istring::replace(size_t pos, size_t count, const string_view& str) {