bf(C++) offers many solutions for common problems. Most of these facilities
are part of the em(Standard Template Library) or they are implemented as
em(generic algorithms) (see chapter ref(GENERIC)).

Among the facilities bf(C++) programmers have developed over and over again
are those manipulating chunks of text, commonly called em(strings). The bf(C)
programming language offers rudimentary string support.

To process text bf(C++) offers a hi(string)tt(std::string) type. In bf(C++)
the traditional bf(C) library functions manipulating NTB strings are
deprecated in favor of using tt(string) objects. Many problems in bf(C)
programs are caused by buffer overruns, boundary errors and allocation
problems that can be traced back to improperly using these traditional bf(C)
string library functions. Many of these problems can be prevented using
bf(C++) string objects.

Actually, tt(string) objects are em(class type) variables, and in that sense
they are comparable to stream objects like tt(cin) and tt(cout). In this
section the use of tt(string) type objects is covered. The focus is on their
definition and their use. When using tt(string) objects the
    emi(member function) em(syntax) is commonly used:
    verb(        stringVariable.operation(argumentList))

For example, if tt(string1) and tt(string2) are variables of type
tt(std::string), then
    verb(        string1.compare(string2))

can be used to compare both strings.

In addition to the common member functions the tt(string) class also offers a
wide variety of em(operators), like the assignment (tt(=)) and the comparison
operator (tt(==)). Operators often result in code that is easy to understand
and their use is generally preferred over the use of member functions offering
comparable functionality. E.g., rather than writing
        verb(    if (string1.compare(string2) == 0))

the following is generally preferred:
        verb(    if (string1 == string2))

To define and use tt(string)-type objects, sources must include the header
file tthi(string). To merely hi(string: declaring) em(declare) the string type
the header i(iosfwd) can be included.

In addition to tt(std::string), the header file tt(string) defines the
following string types:
    itemization(
    itht(wstring)(std::wstring), a string type consisting of tt(wchar_t)
        characters;
    itht(u16string)(std::u16string), a string type consisting of tt(char16_t)
        characters; 
    itht(u32string)(std::u32string), a string type consisting of tt(char32_t)
        characters. 
    )
