15 Introduction to Standard Template Library STL

STL

        STL, the Standard Template Library, is called the Standard Template Library in English. STL was originally developed by Hewlett-Packard Laboratories and was designated as an international standard in 1998. It has officially become an indispensable and important part of the C++ standard library, and it is also a very revolutionary part of the C++ standard library. STL contains many basic data structures and basic algorithms commonly used in the field of computer science, providing us with an extensible application framework, which highly reflects the reusability of software.

        STL adopts the idea of ​​generic programming and uses the mechanism of C++ class templates and function templates. It is mainly composed of three parts: containers, algorithms and iterators. An important feature of STL is the separation of data and operations. Data is managed by containers, operations are controlled by algorithms, and iterators act as glue between the two, so that any algorithm can cooperate with any container.

container

        A container is a data structure used to manage certain types of objects in STL, and it will automatically apply for and release memory without explicitly performing new and delete operations. Each container has its advantages and disadvantages. In order to meet the different needs in program development, STL has prepared seven basic container types, namely:

  • vector

  • list

  • Double-ended queue (deque)

  • set

  • multiset

  • map

  • Multimap (multimap)

        These seven basic container types can be divided into two categories

Guess you like

Origin blog.csdn.net/hope_wisdom/article/details/130167369