Comment 8 for bug 1246802

Revision history for this message
In , Paolo-carlini (paolo-carlini) wrote :

Don't tell me is just this:

Index: include/bits/stl_algo.h
===================================================================
--- include/bits/stl_algo.h (revision 203835)
+++ include/bits/stl_algo.h (working copy)
@@ -1917,7 +1917,7 @@
     _RandomAccessIterator __last, _Compare __comp)
     {
       _RandomAccessIterator __mid = __first + (__last - __first) / 2;
- std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2),
+ std::__move_median_to_first(__first, __first + 1, __mid, (__last - 1),
       __comp);
       return std::__unguarded_partition(__first + 1, __last, __first, __comp);
     }

??

Andy, while waiting for Chris' feedback, you may want to test the above on your real applications. In 4.8.x some nth_algorithm details are different (the above is versus mainline), but you can quickly find a couple of (__last - 2) which I'm asking you to change to (__last - 1)