December 2020
Intermediate to advanced
544 pages
12h 45m
English
This chapter will introduce some essential classes from the C++ Utility library. Some of the metaprogramming techniques presented in the previous chapter will be used in order to work effectively with collections that contain elements of different types.
C++ containers are homogenous, meaning that they can only store elements of one single type. A std::vector<int> stores a collection of integers and all objects stored in a std::list<Boat> are of type Boat. But sometimes, we need to keep track of a collection of elements of different types. I will refer to these collections as heterogenous collections. In a heterogeneous collection, the elements may have different types. The following figure shows an example of a homogenous ...