Chapter 14. The C++ STL String Class
Once upon a time there was the C language, developed to allow you to program close to the metal, writing efficient code while taking responsibility for all risks.
C’s handling of text strings is typical of this close-to-the-metal approach; the old C-language string type is a simple array of char. C and C++ don’t stop you from reserving ten bytes for a string and then trying to write 11 characters to it.
But for a number of years now, C++ compilers have supported the new string class as part of the Standard Template Library (STL). Although the old C-string type is still supported, and it’s sometimes necessary to convert to or from that type, the new string class is an improvement in almost every way. Such a ...