If | |||
Lower bound | a.lower_bound(k) | Returns an iterator pointing to the first element whose key is not less than | If |
Upper bound | a.upper_bound(k) | Returns an iterator pointing to the first element whose key is greater than | Returns |
Equal range | a.equal_range(k) | Returns a pair whose first element is |
Erase element is constant time.
Erase key is
Erase range is
Find is logarithmic. [1]
Count is
Lower bound, upper bound, and equal range are logarithmic. [1]
Definition of | If |
Ascending order | The elements in a Sorted Associative Container are always arranged in ascending order by key. That is, if |
• set
• multiset
• map
• multimap
[1] This is a much stronger guarantee than the one provided by Associative Container. The guarantees in Associative Container only apply to average complexity; worst case complexity is allowed to be greater. Sorted Associative Container, however, provides an upper limit on worst case complexity.
[2] This definition is consistent with the semantics described in Associative Container. It is a stronger condition, though: if
Associative Container, Hashed Associative Container
Hashed Associative Container
Category: containers
Component type: concept
A Hashed Associative Container is an Associative Container whose implementation is a hash table. [1] The elements of a Hashed Associative Container are not guaranteed to be in any meaningful order; in particular, they are not sorted. The worst case complexity of most operations on Hashed Associative Containers is linear in the size of the container, but the average case complexity is constant time; this means that for applications where values are simply stored and retrieved, and where ordering is unimportant, Hashed Associative Containers are usually much faster than Sorted Associative Containers.
Associative Container
The following new types are introduced, in addition to the types defined in the Associative Container requirements.
Hash function |