Lower_bound in c++ sets

#include
#include
#include
using namespace std;
int main()
{
sets;
s.insert(1);
s.insert(5);
s.insert(7);
s.insert(2);
s.insert(12);
s.insert(10);
auto it = s.lower_bound(15);
cout<< *it <<endl;
return 0;
}

why is the output of this program is 6
the iterator should point to adress after the last element of set

NO
lower_bound doesn’t work like this

The lower_bound() method in C++ is used to return an iterator pointing to the first element in the range [first, last) which has a value not less than val. This means that the function returns the index of the next smallest number just greater than or equal to that number. If there are multiple values that are equal to val, lower_bound() returns the index of the first such value.

image