STL Introduction
STL, the standard Template Library, is a collection of basic templates provided by the C + + language, originally developed by HP Labs and established as a standard library for C + + in 1998.
In the C + + standard, STL is organized into 13 header files:<algorithm>, <deque>, <functional>, <iterator>, <vector>, < List>, <map>, <memory>, <numeric>, <queue>, <set>, <stack> and <utility>. The STL consists of a space manager, an iterator, a functional, an adapter, a container, and an algorithm 6 part, of which the first 4 parts serve the latter two parts.
The Space Manager provides a user-defined memory request and release capability for the container class template. By default, the STL uses the memory management functions or operators of C/C + + to complete dynamic memory requests and releases. Instead of using these methods, users can redefine their own new policies to implement memory management.
Iterators are used to store an object's address (point to an object), either to provide data input to an algorithm in the STL or to traverse objects in a container class or stream. Pointers can be thought of as an iterator.
By introducing a functional, you can provide some strategies for the algorithm. In STL, if a class overloads the function call operator "()", the class is called a functional class, and its object is called a functional.
The adapter object binds itself to another object, which transforms the operation of the adapter object into an operation on the bound object. There are container adapters, iterator adapters, and functional adapters in the STL.
A container is a data structure that can contain several objects and provides a small number of operating interfaces. STL provides three standard containers: sequential containers, sorting containers, and hash containers, and three containers are stored in completely different ways, so even the same operating efficiency is different.
Sequential containers: Include vectors, lists, and double-ended queues.
Sorting containers: Includes collections, multiset, mappings, and Multimap.
Hash container: Includes hash set, hash multiset, hash map, and hash multimap.
In STL, all algorithms are provided in the form of function templates. The next step is to introduce the implementation of some algorithms.
Learn STL--Introduction to STL