Standard Template Library of C++

The built-in STL of C++ can be divided into the following six categories:
Containers, iterators, allocators, adapters, algorithms, functors
These six categories of templates are organized in 13 header files by C++:
<vector>、<list>、<deque>、<set>、<map>、<stack>、<queue>、<array>、<iterator>、<memory>、<algorithm>、<numeric>、<functional>

Overview: A container is an entity that stores different objects. Different objects can be put into the container and managed and maintained through the internal structure of the container. Containers can be divided into three categories and 10 types (vector, deque, list, set, multist, map, multimap, stack, queue, priority_queue). The iterator is the encapsulation of the pointer, which is closely related to the container and is the internal type of the container. There are four types of iterators: iterator, const_iterator, reverse_iterator, and const_reverse_iterator. The space allocator is mainly used to allocate and release space for the elements in the container. The adapter can be understood as the function of the converter. Functors can be simply understood as function objects. Algorithms are nearly 100 algorithms implemented by STL templates and can be used directly.

1. Container
2. Iterator

3. Algorithm

4. Space allocator

By default, the space allocator is divided into two levels of space allocators. If the memory space requested is greater than 128 bytes, it will be processed by the first-level space allocator, and if it is less than or equal to 128 bytes, it will be processed by the second-level space allocator.

Five, functor

The essence is to overload the operator "()" function. Functors are functions in form, but execute faster than functions. Mainly to expand the function of the algorithm, the functor is also called the function object.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324880138&siteId=291194637