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 @   Nextlock  阅读(48)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
点击右上角即可分享
微信分享提示