【C++】| 02——STL | First Acquaintance

Series Article Directory

【C++】| 01——Generic Programming| Templates
【C++】| 02——STL |



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.

  1. Container ———> template class (various data types) that encapsulates the data structure, used to store data
  2. Algorithms ———>Operating Data
  3. Iterator ———> bridge between container and algorithm
  4. function object --> object used as algorithm function parameter
  5. Adapter ——> modify other components
  6. 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.

Guess you like

Origin blog.csdn.net/weixin_43822014/article/details/130576463