Hi
The issues I had when trying to use stable_sort with move_iterator
was in fact not all coming from a missing swap overload. In fact
stable_sort do not accept iterators with dereference operator
returning pure rvalue. I use std::vector<bool>::iterator to illustrate
this problem. The problem was in fact coming from
__uninitialized_construct_buf that was taking a lvalue reference. I
simply modify the function and the underlying helper struct to
dereference the iterator as late as possible that is to say only when
we need to pass it to the std::move function.
2012-05-25 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tempbuf.h (__uninitialized_construct_buf)
(__uninitialized_construct_buf_dispatch<>::__ucr): Fix to work
with iterator returning rvalue.
* testsuite/25_algorithms/stable_sort/3.cc: New.
Tested under x86_64 linux with make check and make CXXFLAGS=-std=c++11
check.
Ok to commit ?