#include <stdio.h>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
v.resize(10);
for (int i = 0; i < 10; ++i)
v[i] = 2*i;
std::vector<int>::iterator low,up;
low = std::lower_bound(v.begin(), v.end(), 6);
up = std::upper_bound(v.begin(), v.end(), 6);
std::cout<<"low:"<<*low<<endl;
std::cout<<"up:"<<*up<<endl;
return 0;
}
// 输出:
6
8
lower_bound()
网友评论