From 810ae159910ec0c3b45255b2b26dcdd80933196e Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 26 Apr 2018 12:16:48 -0700 Subject: [PATCH] printer.cpp avoid alloc of spaces No need to allocate a std::string just to repeat spaces. --- src/factory/printer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/factory/printer.cpp b/src/factory/printer.cpp index 3059104..964ff8d 100644 --- a/src/factory/printer.cpp +++ b/src/factory/printer.cpp @@ -31,8 +31,9 @@ std::ostream& operator<<(std::ostream& os, indent_level const& indent) std::ostream& operator<<(std::ostream& os, indent const&) { long il = indent_value(os); - std::size_t spaces = static_cast(il) * 4; - return os << string(spaces, ' '); + for(long i=0, spaces = il * 4; i