We can just use the variant of std::string's replace() function that can replace an occurrence with N copies of the same character, eliminating the need to allocate a std::string containing a buffer of spaces.
4.1 KiB
4.1 KiB