public member function
<unordered_map>

std::unordered_map::equal_range

pair<iterator,iterator>
   equal_range ( const key_type& k );
pair<const_iterator,const_iterator>
   equal_range ( const key_type& k ) const;
Get range of elements with specific key
Returns the bounds of a range that includes all the elements in the container with a key that compares equal to k. In unordered_map containers, where keys are unique, the range will include one element at most.

If k does not match any key in the container, the range returned has end as both its lower and upper range bounds.

Parameters

k
Key value to be compared.
Member type key_type is the type of the keys for the elements in the container, defined in unordered_map as an alias of its first template parameter (Key).

Return value

The function returns a pair, where its member pair::first is an iterator to the lower bound of the range, and pair::second is an iterator to its upper bound. The elements in the range are those between these two iterators, including pair::first, but not pair::second.

Member types iterator and const_iterator are forward iterator types.

Example

See unordered_multimap::equal_range.

Complexity

Average case: constant.
Worst case: linear in container size.

Iterator validity

No changes.

See also

  • 997351548 2018-02-20
  • 903691547 2018-02-20
  • 9127171546 2018-02-20
  • 2234751545 2018-02-20
  • 1685381544 2018-02-20
  • 911091543 2018-02-20
  • 9281021542 2018-02-20
  • 632231541 2018-02-20
  • 9751491540 2018-02-20
  • 8333621539 2018-02-20
  • 995001538 2018-02-20
  • 6477441537 2018-02-20
  • 511981536 2018-02-19
  • 2072881535 2018-02-19
  • 6024461534 2018-02-19
  • 7594061533 2018-02-19
  • 9311341532 2018-02-19
  • 4928331531 2018-02-19
  • 38561530 2018-02-19
  • 7776611529 2018-02-19