When you refers to cppreference, you will find this:
Returns an iterator to the element following the last element of the container. This element acts as a placeholder; attempting to access it results in undefined behavior.
Then I run the following code:
std::set<int> s {1, 2, 3};
cout << *s.end() << endl;
The out put is: 3, why?