From 5426aa835956afc4ce8b374cbf44d9247350c905 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Mon, 10 Jul 2023 18:54:04 -0400 Subject: [PATCH] add template for string buffer --- include/blt/std/string.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/blt/std/string.h b/include/blt/std/string.h index cea9f6a..2611f5b 100755 --- a/include/blt/std/string.h +++ b/include/blt/std/string.h @@ -35,6 +35,14 @@ namespace blt::string { StringBuffer& operator<<(char c); + template + inline StringBuffer& operator<<(T t) { + auto str = std::to_string(t); + for (char c : str) + *this << c; + return *this; + } + ~StringBuffer() { free(characterBuffer); }