Summary
This chapter covered the various options for storing and representing data in C++ code. At a basic level, data in C++ is either fundamental (integers, floats, pointers, etc.) or instances of classes. These can live on the stack or on the heap, where most of the time, one will want to manage the memory using a smart pointer. The main content of this chapter concerns the various kinds of containers that we can use. These generally fall into two categories: linear memory containers (vectors and arrays) and linked lists (essentially, everything else). Generally speaking, linear memory has better performance for traversal and direct memory access, but is less performant when inserting or deleting elements, especially when these operations occur at the beginning of the data. For almost every data storage problem that doesn’t require some additional structure, a vector is almost certainly the right tool for the job: just use a vector.
The second half of the chapter covered...