Associative containers)
According to the data arrangement in containers, containers can be divided into two types: sequence and associative.
The standard STL associated containers are divided into two categories: Set and map, and the derivative et (Multi-key set) and multimap (Multi-key ing table ). The underlying mechanism of these containers is implemented by RB-tree (red-black tree. RB-tree is also an independent container, but it is not open for external use.
In addition, sgi stl provides an associated container that is not included in the Specification standard column: hash table (hash table) and hash_set (hash set) completed using this hash table as the underlying mechanism), hash_map (hash ing table), hash_multiset (hash multi-key set), and hash_multimap (hash multi-key ing table ).
The so-called associative container is similar to the relational database in concept: each data has a key and a real value ). When an element is inserted into an associated container, the internal structure of the container (RB-tree or hash-table) is determined by its key value, place this element in the appropriate location using a specific rule.
Generally, the internal structure of the correlated container is a balance binary tree (balanced binary tree) to achieve good efficiency.