1. STL definition _
STL ( Standard Template Library ) A collective term for a family of software developed by HP Labs . The purpose of STL is to standardize components so that off-the-shelf components can be used without redevelopment. STL is now part of C++ , built into your build system.
2. STL header file
In the C++ standard, the STL is organized into the following 17 header files: < algorithm >, < deque >, < functional >, < iterator >, < array >, < vector >, < list >, <forward_list>, <map> , <unordered_map>, <memory>, < numeric >, < queue >, < set >, <unordered_set>, < stack >, < utility >.
3. Components:
STL can be divided into six parts: container, iterator, space configurator, adapter, algorithm, and functor .
The container part mainly consists of header files < vector > , <list> , <deque> , <set> , <map> , <stack> and <queue> .
serial container
Vector (vector) elements stored contiguously <vector>
List (list) is a doubly linked list consisting of nodes, each node contains an element <list>
A double-ended queue (deque) is an array of pointers to different elements stored consecutively <deque>
container adapter
Array of LIFO values on the stack < stack >
Queue (queue) first in first out value arrangement <queue>
The order of the elements of the priority queue (priority_queue) is a queue <queue> in which the order of the elements is determined by some kind of predicate acting on the stored value pairs
associative container
A set (set) is a red-black tree composed of nodes, each node contains an element, and the nodes are arranged by some kind of predicate acting on the pair of elements, no two different elements can have the same order <set>
Multiset (multiset) allows the existence of two sets of elements in equal order <set>
map (map) A collection of { key, value } pairs arranged with some predicate acting on the key pairs <map>
Multimap ( multimap ) allows key pairs to have equal order map <map>