std::map<Key,T,Compare,Allocator>::lower_bound_C++中文网

std::map<Key,T,Compare,Allocator>::lower_bound

iterator lower_bound( const Key& key );

(1)

const_iterator lower_bound( const Key& key ) const;

(1)

template< class K >
iterator lower_bound(const K& x);

(2) (C++14 起)

template< class K >
const_iterator lower_bound(const K& x) const;

(2) (C++14 起)

1) 返回指向首个不小于 key 的元素的迭代器。

2) 返回指向首个比较不小于x 的元素的迭代器。此重载仅若有限定 id Compare::is_transparent 合法并指代一个类型才参与重载决议。它们允许调用此函数而无需构造 Key 的实例。

参数

key - 要与元素比较的关键值
x - 能与 Key 比较的替用值

返回值

指向首个不小于 key 的元素的迭代器。若找不到这种元素,则返回尾后迭代器(见 end() )。

复杂度

与容器大小成对数。

参阅