Series Article Directory
【C++】| 01——Generic Programming| Templates
【C++】| 02——STL |
Article directory
1. What is STL
STL is the Standard Template Library (short for Standard Template Library). It is a generic library whose components are parameterized. It provides common programming data structures and functions such as lists, stacks, and arrays, and components such as container classes, algorithms, and iterators. It is a collection of algorithms, data structures, and other components used to simplify the development of C++ programs.
Its implementation is based on templates, so learning templates is a prerequisite for learning STL.
2. The six components of STL
STL contains the following six key components
, which will be introduced in detail later in the following brief understanding.
- Container ———> template class (various data types) that encapsulates the data structure, used to store data
- Algorithms ———>Operating Data
- Iterator ———> bridge between container and algorithm
- function object --> object used as algorithm function parameter
- Adapter ——> modify other components
- Allocator——>Provide memory allocation function
3. STL role
By using the STL, you can simplify your code, reduce the possibility of errors, and improve the performance of your programs.