http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52822

--- Comment #9 from Jeffrey Yasskin <jyasskin at gcc dot gnu.org> 2012-04-12 
20:59:14 UTC ---
Author: jyasskin
Date: Thu Apr 12 20:59:09 2012
New Revision: 186391

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186391
Log:
Fix PR52822 (stable_partition move-assigns object to itself) by
scanning for the first value that doesn't match the predicate before
starting to rearrange values.

2012-04-03   Jeffrey Yasskin  <jyass...@google.com>

    PR libstdc++/52822
    * include/bits/stl_algo.h (__find_if_not): Expose in
    C++98 mode.
    (__find_if_not_n): Like __find_if_not, but works on and updates a
    counted range instead of a bounded range.
    (stable_partition): Guarantee !__pred(*__first) in call to
    __stable_partition_adaptive() or __inplace_stable_partition().
    (__stable_partition_adaptive): Use new precondition to avoid
    moving/copying objects onto themselves.  Guarantee new
    precondition to recursive calls.
    (__inplace_stable_partition): Use new precondition to simplify
    base case, remove __last parameter.  Guarantee new precondition to
    recursive calls.
    * testsuite/25_algorithms/stable_partition/moveable.cc (test02):
    Test a sequence that starts with a value matching the predicate.
    * testsuite/25_algorithms/stable_partition/pr52822.cc:
    Test vectors, which have a destructive self-move-assignment.

Added:
    trunk/libstdc++-v3/testsuite/25_algorithms/stable_partition/pr52822.cc
      - copied, changed from r186389,
trunk/libstdc++-v3/testsuite/25_algorithms/stable_partition/moveable.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/stl_algo.h
    trunk/libstdc++-v3/testsuite/25_algorithms/stable_partition/moveable.cc

Reply via email to