9. Containers as Data Members

CarInfo, DataPacket, and Product types used relatively simple data members like integers, doubles, or strings. While std::string is, in fact, a container (of characters), we tend to use it as an elementary type. In this section, I’d like to discuss more complex data members like arrays, vectors, or maps.

The basics

Content available in the full version of the book.

Using std::initializer list

(*) this section will be added in the future.

Example implementation

Content available in the full version of the book.