Introduction

Get introduced to the concepts we will learn in this chapter.

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. We 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 collection of ints and a heterogenous collection with elements of different types:

Get hands-on with 1200+ tech skills courses.