Q7 C++ STL QUIZ-1

In the question we are given a set in which all the values are less than 15 , then an iterator is created with value lower_bound(15) and the output of (*it) is given to be 6.

How is it possible? Shouldn’t it be some random garbage value?

Hey @raghav0712 in this case when the element being searched is greater than the maximum element the set the returned value which is number of elements in the set which in this case is 6.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Thank you for helping me