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用法一致

posted @ 2022-01-15 16:31  Nextlock  阅读(69)  评论(0)    收藏  举报