According to http://www.cplusplus.com/reference/algorithm/partial_sort/, the middle argument is a:
Random-access iterator pointing to the element within the range
[first,last)that is used as the upper boundary of the elements that are fully sorted.
Specifically, middle isn't allowed to be equal to last. However, https://en.cppreference.com/w/cpp/algorithm/partial_sort seems to have entirely different documentation and doesn't mention any range restrictions (but obviously middle shouldn't be outside [first, last]).
Is behavior defined when middle == last?