9.2. Container Library Overview

Image

The operations on the container types form a kind of hierarchy:

• Some operations (Table 9.2 (p. 330)) are provided by all container types.

Table 9.2. Container Operations

Image
Image

• Other operations are specific to the sequential (Table 9.3 (p. 335)), the associative (Table 11.7 (p. 438)), or the unordered (Table 11.8 (p. 445)) containers.

Table 9.3. Defining and Initializing Containers

Image

• Still others are common to only a smaller subset of the containers.

In this section, we’ll cover aspects common to all of the containers. The remainder of this chapter will then focus solely on sequential containers; we’ll cover operations specific to the associative containers in Chapter 11.

In general, each container is defined in a header file with the same name as the type. That is, deque is in the deque header, list in the list header, and so on. The containers are class templates (§ 3.3, p. 96). As with vectors, we must supply additional information to generate a particular container type. For most, but not all, of the containers, the information we must supply is the element type:

list<Sales_data>   // list that holds Sales_data objects
deque<double>      // deque that holds doubles

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.54.255