Defined Terms
associative array Array whose elements are indexed by key rather than positionally. We say that the array maps a key to its associated value.
associative container Type that holds a collection of objects that supports efficient lookup by key.
hash Special library template that the unordered containers use to manage the position of their elements.
hash function Function that maps values of a given type to integral (
size_t
) values. Equal values must map to equal integers; unequal values should map to unequal integers where possible.key_type Type defined by the associative containers that is the type for the keys used to store and retrieve values. For a
map
,key_type
is the type used to index themap
. Forset
,key_type
andvalue_type
are the same.map Associative container type that defines an associative array. Like
vector
,map
is a class template. Amap
, however, is defined with two types: the type of the key and the type of the associated value. In amap
, a given key may appear only once. Each key is associated with a particular value. Dereferencing amap
iterator yields apair
that holds aconst
key and its associated value.mapped_type Type defined by map types that is the type of the values associated with the keys in the map.
multimap Associative container similar to
map
except that in amultimap
, a given key may appear more than once.multimap
does not support subscripting.multiset Associative container type that holds keys. In a
multiset
, a given key may appear more than once.pair Type that holds two
public
data members namedfirst
andsecond
. Thepair
type is a template type that takes two type parameters that are used as the types of these members.set Associative container that holds keys. In a
set
, a given key may appear only once.strict weak ordering Relationship among the keys used in an associative container. In a strict weak ordering, it is possible to compare any two values and determine which of the two is less than the other. If neither value is less than the other, then the two values are considered equal.
unordered container Associative containers that use hashing rather than a comparison operation on keys to store and access elements. The performance of these containers depends on the quality of the hash function.
unordered_map Container with elements that are key–value pairs, permits only one element per key.
unordered_multimap Container with elements that are key–value pairs, allows multiple elements per key.
unordered_multiset Container that stores keys, allows multiple elements per key.
unordered_set Container that stores keys, permits only one element per key.
value_type Type of the element stored in a container. For
set
andmultiset
,value_type
andkey_type
are the same. Formap
andmultimap
, this type is apair
whosefirst
member has typeconst key_type
and whosesecond
member has typemapped_type
.*
operator Dereference operator. When applied to amap
,set
,multimap
, ormultiset
iterator*
yields avalue_type
. Note, that formap
andmultimap
, thevalue_type
is apair
.[ ]
operator Subscript operator. Defined only for nonconst
obejcts of typemap
andunordered_map
. For the map types,[]
takes an index that must be akey_type
(or type that can be converted tokey_type
). Yields amapped_type
value.