# lower_bound()返回值

pos = lower_bound( number, number + 8, 3) - number，pos = 0.即number数组的下标为0的位置。

pos = lower_bound( number, number + 8, 9) - number， pos = 1，即number数组的下标为1的位置（即10所在的位置）。

pos = lower_bound( number, number + 8, 111) - number， pos = 8，即number数组的下标为8的位置（但下标上限为7，所以返回最后一个元素的下一个元素）。

#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;

int main()
{
const int VECTOR_SIZE = 8 ;

// Define a template class vector of int
typedef vector<int > IntVector ;

//Define an iterator for template class vector of strings
typedef IntVector::iterator IntVectorIt ;

IntVector Numbers(VECTOR_SIZE) ;

IntVectorIt start, end, it, location ;

// Initialize vector Numbers
Numbers[0] = 4 ;
Numbers[1] = 10;
Numbers[2] = 11 ;
Numbers[3] = 30 ;
Numbers[4] = 69 ;
Numbers[5] = 70 ;
Numbers[6] = 96 ;
Numbers[7] = 100;

start = Numbers.begin() ;   // location of first
// element of Numbers

end = Numbers.end() ;       // one past the location
// last element of Numbers

// print content of Numbers
cout << "Numbers { " ;
for(it = start; it != end; it++)
cout << *it << " " ;
cout << " }\n" << endl ;

// return the first location at which 10 can be inserted
// in Numbers
location = lower_bound(start, end, 1) ;

cout << "First location element 10 can be inserted in Numbers is: "
<< location - start<< endl ;
}