string_streamx is a string_stream with additional formatting options.
Currently the only extra option is the ability to expand strings to a
length using a fill character, along with left/right justification. More
options similar to std::stringstream may be added in the future. These
extra options do come at a performance cost, and string_stream should be
preferred unless the extra options are absolutely needed.
This implementation also writes the digits from left to right instead of
right to left. Using this method we can write the string to the
beginning of the buffer and still avoid reversing the string. It also
has the benefit of being slightly slower than the previous
implementation. The function's signature changed as well because there
is no longer a reason to pass the buffer size or a pointer to output the
start of the string.
Can't use std::exception because it dynamically allocates memory. This
implementation doesn't allocate memory, but also doesn't allow leaving
an exception message.
The istring and string_view operators have identical implementations. By
changing the istring operators to cast to string_view and use that
implementation instead, the number of redundant implementations is
reduced. This does incurr a small performance penalty, around 15 cycles
when tested on the MGBA Gameboy Advance emulator (uses an armv7tdmi).
When compared to the time operations take, the performance difference is
negligible. Ex. An insertion with two 8 character strings takes around
450 cycles.