5
Standard Library Containers, Algorithms, and Iterators
The C++ standard library has evolved a lot with C++11, C++14, C++17, and now C++20. However, at its core initially sat three main pillars: containers, algorithms, and iterators. They are all implemented as general-purpose classes or function templates. In this chapter, we'll look at how these can be employed together for achieving various goals.
We will cover the following recipes in this chapter:
- Using vector as a default container
- Using bitset for fixed-size sequences of bits
- Using
vector<bool>
for variable-size sequences of bits - Using the bit manipulation utilities
- Finding elements in a range
- Sorting a range
- Initializing a range
- Using set operations on a range
- Using iterators to insert ...
Get Modern C++ Programming Cookbook - 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.