Do anyone know if there is a STL interface compatible string class that allocates memory for small strings on the stack (up to a certain threshold) and the heap for larger s
__versa_string SSO version can store no more than 15 bytes on the stack and if it does, it reserves 16 bytes regardless of the string size ( http://codepad.org/2M7N9cTu ).
http://www.and.org/ustr/ can reuse a stack buffer, but I had problems linking with it under Debian Wheezy 64bit.
http://freecode.com/projects/str-class can reuse a stack buffer.
I wrote a header-only string class which uses just four bytes and can reuse a stack buffer:
http://code.google.com/p/libglim/source/browse/trunk/gstring.hpp
It has a limited STL compatibility: basic_streambuf implemented for use with std::ostream.