[Patch] Fix to random_access overload of std::reverse
Chris Jefferson
caj@cs.york.ac.uk
Thu Sep 9 17:49:00 GMT 2004
This is a (hopefully) simple patch the overload of std::reverse in the
random-access case.
Firstly the comment on the function is wrong because it refers to
bidirectional iterators.
Secondly, the existing version has two main problems. It needlessly uses
a post-increment, and also when the given vector is of odd length it
swaps the middle element with itself, which I suspect violates the
standard on this issue. This patch fixes both these problems.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_reverse
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040909/c972412a/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_reverse
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040909/c972412a/attachment-0001.ksh>
More information about the Libstdc++
mailing list