Suppose I have a vector, vector<int>v = {1,3,5,7} and I do lower bound like auto itr = lower_bound(v.begin(),v.end(),8) so will it return the pointer to the end of the vector? or what will the output of it? cout<<(*itr) , If I am doing this cout, then the output is coming out to be 0, I know lower bound gives us >=. But got confused with this article where the element 55 is not even present and it is returning the iterator to the last element.
C++ STL lower_bound
If lower bound returns element which is greater than or equal to , i.e >=, then why that article is giving the iterator to the last element?
What should be the output when v={1,3,5,7}, and we do lower bound with key=8?
Hi raghav
The article example is incorrect. Look at code below it.
It returns iterator index = 5 which is v.end(), which follows last element, and is not the last element.
v={1,3,5,7}, and we do lower bound with key=8,
itr will point to v.end() and *itr = 0.
Hope it helps 
I was thinking the same! Thank you! 
No problem 
Do give a rating if satisfied