lower_bound与upper_bound()的用法
lower_bound与upper_bound都在
使用方法是:
#include <algorithm>
int *p1 = lower_bound(first,last,val,comp);
int *p2 = upper_bound(first,last,val,comp);
Returns an iterator pointing to the first element in the range [first,last) which does not compare less(or more) than val.
lower_bound与upper_bound都返回一个迭代器
lower_bound的指向范围内[first,last)大于或等于val的第一个元素。
upper_bound的指向范围内[first,last)大于val的第一个元素。
comp的用法与sort中的comp用法一致

浙公网安备 33010602011771号