Chapter 11

Delving into the Standard Library


  • What the coding principles used throughout the Standard Library are
  • What kind of functionality the Standard Library provides

The most important library that you will use as a C++ programmer is the C++ standard library. As its name implies, this library is part of the C++ standard, so any standards-conforming compiler should include it. The standard library is not monolithic: It includes several disparate components, some of which you have been using already. You may even have assumed they were part of the core language.

The heart of the C++ standard library is its generic containers and algorithms. This subset of the library is often called the Standard Template Library, or STL for short, because of its abundant use of templates. The power of the STL is that it provides generic containers and generic algorithms in such a way that most of the algorithms work on most of the containers, no matter what type of data the containers store. Performance is a very important part of the STL. The goal is to make the STL containers and algorithms as fast as or faster than hand written code.

Many programmers who claim to know C++ have never heard of the Standard Template Library. A C++ programmer who wishes to claim language expertise is expected to be familiar with the Standard Template Library. You can save yourself immeasurable time and energy by incorporating the STL containers and algorithms into your programs instead ...

Get Professional C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.