Chapter 16Understanding Containers and Iterators

  • Explaining iterators
  • Containers Overview: requirements on elements, general error handling, and iterators
  • Sequential Containers: vector, deque, list, forward_list, and array
  • Container Adapters: queue, priority_queue, and stack
  • Associative Containers: the pair utility, map, multimap, set, and multiset
  • Unordered Associative Containers/Hash Tables: unordered_map, unordered_multimap, unordered_set, and unordered_multiset
  • Other Containers: standard C-style arrays, strings, streams, and bitset

Please note that all the code examples for this chapter are available as a part of this chapter’s code download on the book’s website at www.wrox.com/go/proc++3e on the Download Code tab.

Chapter 15 introduces the STL, describes its basic philosophy, and provides an overview of the various containers and algorithms. This chapter begins a more-in-depth tour of the STL by covering the STL containers. A detailed list of available classes and methods can be found in a Standard Library Reference; for example, http://www.cppreference.com/ or http://www.cplusplus.com/reference/.

The next chapters go deeper on topics such as algorithms, regular expressions, and how you can customize and extend the STL.

CONTAINERS OVERVIEW

Containers in the STL are generic data structures useful for storing collections of data. You should rarely need to use a standard C-style array, write a linked list, or ...

Get Professional C++, 3rd 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.