Chapter 6. Programming with the Standard Library

In This Chapter

  • Architecting the Standard C++ Library

  • Storing data in vector or map

  • Containing data with a list or set

  • Stacking and queuing

  • Copying containers

When you get around in the world of C++ programming (a fun world indeed!), you're going to encounter two different libraries that people use to make their lives easier. That is, after all, the ultimate point of computers — to make our lives easier, right? These two libraries are

  • Standard C++ Library

  • Standard Template Library (STL)

Some people say, "We use STL." Others say, "We use the Standard C++ Library." In this case, library means a set of classes that you can use in your programs. These libraries include handy classes, such as string and vector (which is like an array in that it's a list in which you can store objects).

The difference between the Standard C++ Library and STL is that STL came first. STL was used by so many developers that the American National Standards Institute (ANSI) decided to standardize it. The result is the similar Standard C++ Library that is part of the official ANSI standard and now part of most modern C++ compilers (including CodeBlocks, Microsoft Visual C++, Borland C++ Builder, MinGW, Cygwin, and Dev-C++). We use the Standard C++ Library in this chapter. Because we know that this is C++, we just call it the Standard Library.

The concepts that we present here apply to STL, so if you're using STL, you can use this chapter.

Architecting the Standard Library ...

Get C++ All-In-One For Dummies®, 2nd 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.