For really small range, to make the element pointed at by __nth correct, we don't need to selection sort the whole range, we only need to do partial sort on the range so that [__first, __nth] contains the sorted __nth - __first + 1 smallest elements in the range [__first, __last).
And this can be done by only modifying the terminate condition of outer loop in selection sort since element before __first will not be changed anymore in the future round.
The difference is that the latter will end up earlier and make less comparison unless __nth equal to __last - 1 in which case there are same number of comparisons.
Please make this a _LIBCPP_ASSERT instead.