From an external source:
There appears to be an error in your documentation here:
This is your example:
The example program illustrates finding the fifth largest value in a vector of random numbers.
However nth_element uses < as the default predicate so your example will produce the 5th smallest element, not the 5th largest.
To get the fifth largest you should use std::greater<int>() as a predicate or use the fifth from the other end, i.e. aVec.end() - 5.