std::set::equal_range
std::pair<iterator,iterator> equal_range( const Key& key ); | (1) | |
|---|---|---|
std::pair<const_iterator,const_iterator> equal_range( const Key& key ) const; | (2) | |
template< class K > std::pair<iterator,iterator> equal_range( const K& x ); | (3) | (since C++14) |
template< class K > std::pair<const_iterator,const_iterator> equal_range( const K& x ) const; | (4) | (since C++14) |
返回包含容器中具有给定键的所有元素的范围。范围由两个迭代器定义,一个指向第一个元素,即不折不扣比key另一个指向第一个元素更大比key或者,第一个迭代器可以用lower_bound(),第二个upper_bound()...
1,2%29将密钥与key...
3,4%29将键与值进行比较。x。此重载仅在下列情况下才参与重载解析:Compare::is_transparent是有效的,并表示类型。它们允许调用此函数,而无需构造Key...
参数
key | - | key value to compare the elements to |
|---|---|---|
x | - | alternative value that can be compared to Key |
返回值
std::pair包含一对迭代器,定义想要的范围:第一个指向第一个元素,而不是再少点比key第二个指向第一个元素更大比key...
如果没有元素不折不扣比key,超过-结束%28见end()%29迭代器作为第一个元素返回。类似地,如果没有元素更大比key,则返回作为第二个元素的过去-结束迭代器。
复杂性
容器大小的对数。
例
另见
find | finds element with specific key (public member function) |
|---|---|
upper_bound | returns an iterator to the first element greater than the given key (public member function) |
lower_bound | returns an iterator to the first element not less than the given key (public member function) |
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

