泛型算法系列5:lower_bound()&&upper_bound()

来源:互联网 发布:linux c编程pdf下载 编辑:程序博客网 时间:2024/05/02 05:03

注释:

binary_search:判断是否存在某个对象
lower_bound: 返回>=对象的第一个位置,lower_bound(2)=3, lower_bound(3)=3
目标对象存在即为目标对象的位置,不存在则为后一个位置.
upper_bound: 返回>对象的第一个位置, upper_bound(2)=3,upper_bound(3)=4
无论是否存在都为后一个位置.

原创粉丝点击