#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { const int SIZE = 10; int a1[] = { 2, 2, 4, 4, 4, 6, 6, 6, 6, 8 }; vector< int > v( a1, a1 + SIZE ); vector< int >::iterator lower; lower = lower_bound( v.begin(), v.end(), 6 ); cout << "\n\nLower bound of 6 is element " << ( lower - v.begin() ) << " of vector v"; return 0; }
26.3.lower_bound | ||||
26.3.1. | Return an iterator from std::lower_bound | |||
26.3.2. | Use lower_bound to locate the first point at which 5 can be inserted in order | |||
26.3.3. | Lower bound of 6 |