On 27 Jan, 16:58, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
> Eric Lilja wrote:
>
> > My problem is this particular part of the assignment:
> > * The five smallest values in the vector shall then be found by
> > sorting the
> > vector, but not more than necessary.
>
> > The way I'm using sort it will sort the entire vector, but it sounds
> > like the author of this assignment wants me to stop sorting after the
> > five smallest values has been placed first in the vector, in ascending
> > order. How do I do that??
>
>I think, you might be interested in std:
artial_sort().
Thanks! Seems to work just fine, but I guess I have to special case
the code when the vector contains less than five elements.
>
> Best
>
> Kai-Uwe Bux
- Eric