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:
parent
8e58ff710d
commit
6d5c083616
@ -255,7 +255,12 @@ istring& istring::operator+=(const string_view& str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
istring& istring::operator+=(char ch) {
|
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) {
|
istring& istring::replace(size_t pos, size_t count, const string_view& str) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user