sstring is a C++ string class utilizing both stack and heap allocations and having an STL-compatible interface.
WARNING: This is a work in progress. It generally works but the interface is not fully implemented, and a test suite has not yet been written.
The main purpose of this class is to provide a string that allocates its memory predominately or entirely from the stack rather than the heap. The reason for avoiding heap allocations is that they can be relatively expensive (and may also introduce memory fragmentation). Heap-predominant implementations like STL's std::basic_string can be an order or magnitude slower than pure stack implementations such as char arrays. See the included sstring_benchmark.cpp for benchmark comparisons using this class. In a simple test, one finds sstring to be up to an order of magnitude faster than std::basic_string and a bit slower than char arrays. However, this class may be worse in other situations, so use it only when the benefit is clear.
(c) 2006 David Manura.
Distributed under the Boost Software License, Version 1.0. (www.boost.org)