Abstract
The C++ Standard Library provides a selection of different data structures that you can use to store data. Containers work in tandem with algorithms, described in Chapter 4. Containers and algorithms are designed in such a way that they do not need to know about each other. The interaction between them is accomplished with iterators. All containers provide iterators, and algorithms only need iterators to be able to perform their work.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
The way operator< is defined for Person in the Introduction chapter causes the VIP and non-VIP persons in the priority_queue to be in reverse alphabetical order: people with an alphabetically higher name get a higher priority.
- 2.
Technically, you could easily implement a hash map without buckets: for example, using so-called open addressing. The way the standard unordered containers are defined, though, strongly suggests the use of a separate chaining method, which is therefore what we describe here.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2016 Peter Van Weert and Marc Gregoire
About this chapter
Cite this chapter
Van Weert, P., Gregoire, M. (2016). Containers. In: C++ Standard Library Quick Reference. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1876-1_3
Download citation
DOI: https://doi.org/10.1007/978-1-4842-1876-1_3
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-1875-4
Online ISBN: 978-1-4842-1876-1
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books