Namespaces
Variants

std::multiset<Key,Compare,Allocator>:: upper_bound

From cppreference.net

iterator upper_bound ( const Key & key ) ;
(1) (自 C++26 起为 constexpr)
const_iterator upper_bound ( const Key & key ) const ;
(2) (自 C++26 起为 constexpr)
template < class K >
iterator upper_bound ( const K & x ) ;
(3) (自 C++14 起)
(自 C++26 起为 constexpr)
template < class K >
const_iterator upper_bound ( const K & x ) const ;
(4) (自 C++14 起)
(自 C++26 起为 constexpr)
1,2) 返回指向首个大于 key 的元素的迭代器。
3,4) 返回指向首个大于 x 的元素的迭代器。
此重载仅当 Compare 满足 透明性 时参与重载决议。它允许在不构造 Key 实例的情况下调用此函数。

目录

参数

key - 用于比较元素的键值
x - 可与 Key 进行比较的替代值

返回值

指向首个大于给定键的元素的迭代器,若不存在这样的元素则返回 end ( )

复杂度

与容器大小呈对数关系。

注释

功能测试 标准 功能
__cpp_lib_generic_associative_lookup 201304L (C++14) 关联容器 中的异构比较查找,用于重载版本 ( 3,4 )

示例

参见

返回匹配特定键的元素范围
(公开成员函数)
返回指向首个 不小于 给定键的元素的迭代器
(公开成员函数)