C++ Unordered_set Library - equal_range



Description

It returns the bounds of a range that includes all the elements that compare equal to k. In unordered_set containers, where keys are unique, the range will include one element at most.

Declaration

Following is the declaration for std::unordered_set::equal_range.

C++11

pair<iterator,iterator>
   equal_range ( const key_type& k );
pair<const_iterator,const_iterator>
   equal_range ( const key_type& k ) const;

Parameters

k − K is the search element.

Return value

It returns the bounds of a range that includes all the elements that compare equal to k. In unordered_set containers, where keys are unique, the range will include one element at most.

Exceptions

Exception is thrown if any element comparison object throws exception.

Please note that invalid arguments cause undefined behavior.

Time complexity

constant time.

unordered_set.htm
Advertisements