当前位置: 移动技术网 > IT编程>开发语言>C/C++ > lower_bound()和upper_bound()

lower_bound()和upper_bound()

2019年12月07日  | 移动技术网IT编程  | 我要评论

勇敢的心电视剧全集在线,捉毒蛇让女儿把玩,文熙俊 简美妍

lower_bound()upper_bound() 是方便的在有序数组中二分查找的函数,并且在stl其他数据结构中也提供该方法(如mapset)。
但是两函数并不是二分查找“小于”和“大于”的第一个元素。
lower_bound(first, last, val)大于等于val的第一个元素
upper_bound(first, last, val)严格大于val的第一个元素

lower_bound()

returns an iterator pointing to the first element in the range [first,last) which does not compare less than val.

not compare less than 不小于

upper_bound()

returns an iterator pointing to the first element in the range [first,last) which compares greater than val.

compares greater than 大于

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网