What is the rationale behind the implicit and forced NUL termination of strings that are in the process of being constructed in the string_builder? Where do we depend on this? Is it a byte-0 or is it a wchar-0 ? Is this solely to be able to pass non-finished string builder strings to UNIX system calls? Why not add the zero byte only when the shared string is finalised?
I ask, obviously, because the code is literally *littered* with these NUL termination assignments, which, if they could be avoided would clear up a lot of superfluous cruft.