码迷,mamicode.com
首页 > 编程语言 > 详细

C++ Essentials 之 lower_bound 和 upper_bound 的比较函数格式不同

时间:2018-11-06 12:00:12      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:with   exp   问题   enc   follow   href   temp   cpp   win   

第一次注意到这个问题。

cppreference 上的条目:
lower_bound
upper_bound

C++17 草案 N4659

lower_bound

template<class ForwardIterator, class T>
ForwardIterator
lower_bound(ForwardIterator first, ForwardIterator last, const T& value);

template<class ForwardIterator, class T, class Compare>
ForwardIterator
lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);

Requires: The elements e of [first, last) shall be partitioned with respect to the expression e < value or comp(e, value).

Returns: The furthermost iterator i in the range [first, last] such that for every iterator j in the
range [first, i) the following corresponding conditions hold: *j < value or comp(*j, value) != false.

upper_bound

template<class ForwardIterator, class T>
ForwardIterator
upper_bound(ForwardIterator first, ForwardIterator last, const T& value);

template<class ForwardIterator, class T, class Compare>
ForwardIterator
upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);

Requires: The elements e of [first, last) shall be partitioned with respect to the expression !(value < e) or !comp(value, e).

Returns: The furthermost iterator i in the range [first, last] such that for every iterator j in the
range [first, i) the following corresponding conditions hold: !(value < *j) or comp(value, *j) == false.

C++ Essentials 之 lower_bound 和 upper_bound 的比较函数格式不同

标签:with   exp   问题   enc   follow   href   temp   cpp   win   

原文地址:https://www.cnblogs.com/Patt/p/9914032.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!