This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] libstdc++/59603 Prevent self-swapping in random_shuffle


On 12/09/14 14:34 +0100, Jonathan Wakely wrote:
Swapping an object with itself is pointless, and asserts in debug mode
(but we should probably remove that check from debug mode, since it
can happen in reasonable code).

Tested x86_64-linux, committed to trunk.

I think this makes sense for the branches too, so will backport it
soon.

Now committed to the 4.9 branch (without the comment Chris didn't
like).

   	PR libstdc++/59603
   	* include/bits/stl_algo.h (random_shuffle): Prevent self-swapping.
   	* testsuite/25_algorithms/random_shuffle/59603.cc: New.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]