It seems that there is nothing available in the wild that seems strange.
So, before I give up on my own, does anyone from the std-compatible string stream know which allocates storage on the stack?
I think of two ways to achieve this:
Initially use a static buffer size on the stack (perhaps a template parameter for setting compilation time)
- When the run ends, return to using dynamic storage
- When space runs out, use
alloca to increase stack storage
This will allow you to quickly enter a string stream for lines shorter than the specified size.
A suitable choice for the initial size will mean that things like logging can be achieved without frequently resizing from the heap.
source share