std::lower_bound
同じかそれ以上の値が出現する場所のイテレータを返す。
#include <iostream> #include <vector> #include <algorithm> vector<int> v; vector<int>::iterator pos; for(int i = 0; i < 100; i++){ v.push_back(i); } pos = lower_bound(v.begin(), v.end(), 10); int num = *pos; cout << num << endl; // 10 num = *(++pos); cout << num << endl; // 11