Associative containers
It's like a dictionary whose elements are key-value pairs. The keyword plays an index role.
Ordered:
Map: associative arrays; Pao-value pairs
Set: The keyword is both a value.
Multimap: keyword-repeatable map
Multiset: The keyword can repeat the set
Disordered:
Unordered_ First Four
Using map
Map<sring,size_t> Word_count;
Using Set
Set<string> Exclude
Pair type
A pair type holds two data members.
When creating a pair, we must provide two class names.
Pair type has two members
First
Second
Associative container iterators
When we dereference an iterator for an associative container, we get a reference to the value of the value_type of the container type.
For map, is a pair type, first save the const keyword, second save the value.
The set iterator is a const
adding elements
The insert member of the associated container adds an element or an element range to the container.
Learning C + + Primer's personal understanding (11)