The documentation for upper_bound states:
…it attempts to find the element value in an ordered range [first, last)… upper_bound returns the furthermost iterator i in [first, last) such that, for every iterator j in [first, i), value < *j is false.
However, if we have a vector<int> v that contains the numbers 1, 2, and 3, calling upper_bound(v.begin(), v.end(), 5) will return v.end(). But based on the definition, v.end() is not in the range [v.begin, v.end()). There is no such iterator that fits the requirements in the definition. Is the definition just lazy in not explicitly stating what happens in this case?
SGI documentation is not relevant – the C++ standard is what you should be reading. Quoting C++11 §25.4.3.2: