add string writing support to string buffer

v1
Brett 2023-07-10 19:08:23 -04:00
parent d883adaf5c
commit f15a89328f
1 changed files with 6 additions and 3 deletions

View File

@ -34,12 +34,15 @@ namespace blt::string {
} }
StringBuffer& operator<<(char c); StringBuffer& operator<<(char c);
StringBuffer& operator<<(const std::string& str) {
for (char c : str)
*this << str;
return *this;
}
template<typename T> template<typename T>
inline StringBuffer& operator<<(T t) { inline StringBuffer& operator<<(T t) {
auto str = std::to_string(t); *this << std::to_string(t);
for (char c : str)
*this << c;
return *this; return *this;
} }