Currently it's a template class. It has only one template parameter: EmbeddedCapacity, which defines number of bytes embedded directly into StringBuffer object. (Short strings can be stored in this capacity without heap allocations).
However, we can still cover most use cases if we hard-code specific value of EmbeddedCapacity instead of making it configurable. For example, we can set it to 32 bytes.
If we do so, we can make StringBuffer non-template. Having lots of templates increases code size and compilation times. Also, it will allow us to simplify implementation of core::StringBuilder.
So the steps are simple:
hard-code EmbeddedCapacity to 32
make StringBuffer non-template
move implementations of methods to .cpp file
Then cleanup StringBuilder:
make DynamicBufferWriter non-template
move implementations of methods of DynamicBufferWriter to .cpp file
move implementations of StringBuilder ctor to .cpp file
core::StringBuffer implements simple buffer for storing strings.
Currently it's a template class. It has only one template parameter: EmbeddedCapacity, which defines number of bytes embedded directly into StringBuffer object. (Short strings can be stored in this capacity without heap allocations).
However, we can still cover most use cases if we hard-code specific value of EmbeddedCapacity instead of making it configurable. For example, we can set it to 32 bytes.
If we do so, we can make StringBuffer non-template. Having lots of templates increases code size and compilation times. Also, it will allow us to simplify implementation of core::StringBuilder.
So the steps are simple:
Then cleanup StringBuilder: