Updating nth_element for C++0x

Christopher Jefferson caj@cs.st-andrews.ac.uk
Mon Aug 24 17:01:00 GMT 2009


On 24 Aug 2009, at 10:49, Paolo Carlini wrote:

> -- Chris
>
> coming to more substantive things, I do not understand why the two
> __unguarded_partition_pivot call __unguarded_partition in two  
> different
> ways. In other terms, I would have expected only an additional __comp
> argument.
>

Sorry, you are correct, there is a bug in the __comp one, which came  
from changing some code around and not being consistent. The correct  
form is:

	return __unguarded_partition(__first + 1, __last, *__first, __comp);

Unfortunately, this bug only makes the sort perform poorly, rather  
than misbehave, which is why I didn't catch it.

Chris



More information about the Libstdc++ mailing list