O'Reilly logo

C++ for the Impatient by Brian Overland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required