The road to learning C++ primer-(Chapter 16 Types of STL Template Containers)

1. Types of STL Containers

STL has the concept and type of container. A general category container type with a name (such as container, sequence container, associative container, etc.).

Before C++11, there are 11 types of containers, namely: deque, list, priority_queue, stack, vector, map, multimap, set, multiset, and bitset

After C++11, forword_list (one-way linked list container), unordered_map (map container based on hash table), unordered_set, and unordered_multimap, unordered_multiset are newly added .

Two, STL container characteristics and operation

Containers can store some different data and their different correspondences (associative containers).

The following are the basic characteristics of some container constructors and their basic operating functions:

Among them: X represents the container type, such as: vector; T represents the type of object stored in the container; a and b represent the value of type X; r represents the value of type X& ; u represents the identifier of type X (that is, if X means vector<int>, then u is a vector<int> object) .

 In order of complexity, the order of complexity is as follows:

Compile time> fixed time> linear time

 

1. C++11 new container requirements:

2. Sequence container

deque、priority_queue、stack、vector、list、forword_list

Requirements for sequence containers:

Where  t represents a value of type T (the type of value stored in the container), n represents an integer, and p, q, i, and j represent iterators.

These need to be remembered and will be very common

 

Guess you like

Origin blog.csdn.net/z1455841095/article/details/82734237
Recommended