is a dereferenceable iterator in |
Average complexity for erase key is at most
Average complexity for erase element is constant time.
Average complexity for erase range is at most
Average complexity for count is at most
Average complexity for find is at most logarithmic.
Average complexity for equal range is at most logarithmic.
Contiguous storage | All elements with the same key are adjacent to each other. That is, if |
Immutability of keys | Every element of an Associative Container has an immutable key. Objects may be inserted and erased, but an element in an Associative Container may not be modified in such a way as to change its key. |
• set
• multiset
• hash_set
• hash_multiset
• map
• multimap
• hash_map
• hash_multimap
[1] The reason there is no such mechanism is that the way in which elements are arranged in an associative container is typically a class invariant; elements in a Sorted Associative Container, for example, are always stored in ascending order, and elements in a Hashed Associative Container are always stored according to the hash function. It would make no sense to allow the position of an element to be chosen arbitrarily.
[2] Keys are not required to be Equality Comparable: associative containers do not necessarily use
[3] Note the implications of this member function: it means that if two elements have the same key, there must be no elements with different keys in between them. The requirement that elements with the same key be stored contiguously is an associative container invariant.
Simple Associative Container, Pair Associative Container, Unique Associative Container, Multiple Associative Container, Sorted Associative Container, Unique Sorted Associative Container, Multiple Sorted Associative Container, Hashed Associative Container, Unique Hashed Associative Container, Multiple Hashed Associative Container.
Simple Associative Container
Category: containers
Component type: concept
A Simple Associative Container is an Associative Container where elements are their own keys. A key in a Simple Associative Container is not associated with any additional value.
Associative Container
None, except for those described in the Associative Container requirements. Simple Associative Container, however, introduces two new type restrictions.
Key type | X::key_type | The type of the key associated with |
Iterator | X::iterator | The type of iterator used to iterate through a Simple Associative Container's elements. The types |
X
A type that is a model of Simple Associative Container
a
Object of type
k
Object of type
p, q
Object of type
None, except for those defined in the Associative Container requirements.
Immutability of Elements | Every element of a Simple Associative Container is immutable. Objects may be inserted and erased, but not modified. [1] |