// String class
// Source: The C++ Programming Language (4th Edition), Bjarne Stroustrup
#include <stdexcept>
class String {
// A simple string that implements the short string optimization.
// size()==sz is the number of elements
// if size() <= short_max, the characters are held in the String object
// itself; otherwise the free store is used (short string optimization).
// ptr points to the start of the character sequence
// the character sequence is kept zero-terminated: ptr[size()]==0;
// this allows us to use C library string functions and to easily return a
// C-style string: c_str()
// To allow efficient addition of characters at end, String grows by doubling
// its allocation;
This file has been truncated. show original