Skip to content

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 the map. For set, key_type and value_type are the same.

  • map Associative container type that defines an associative array. Like vector, map is a class template. A map, however, is defined with two types: the type of the key and the type of the associated value. In a map, a given key may appear only once. Each key is associated with a particular value. Dereferencing a map iterator yields a pair that holds a const 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 a multimap, 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 named first and second. The pair 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 and multiset, value_type and key_type are the same. For map and multimap, this type is a pair whose first member has type const key_type and whose second member has type mapped_type.

  • *operator Dereference operator. When applied to a map, set, multimap, or multiset iterator * yields a value_type. Note, that for map and multimap, the value_type is a pair.

  • [ ]operator Subscript operator. Defined only for nonconst obejcts of type map and unordered_map. For the map types, [] takes an index that must be a key_type (or type that can be converted to key_type). Yields a mapped_type value.