2017-05-30 17:43 GMT+02:00 Howard Hinnant via Boost
On May 30, 2017, at 11:30 AM, Andrzej Krzemienski via Boost < boost@lists.boost.org> wrote:
std::sort, apart from what it is allowed to do, is also require to produce the output range that is the permutation of the input range. Assuming no moved-from states on input,
if
for some reason it starts to put objects in a moved-from state and then using this value for sorting further, even if moved-from state is well-ordered, you will get this moved from state in the output range, but it was not in the input range.
Theoretically, a std::sort algorithm could move from x[i], then subsequently perform x[i] < x[i], act on the return of false, and then move assign a new value into x[i], and still get the right answer. I know of no shipping std::sort that actually does this.
Yes, it could do it :) I guess the only purpose would be to verify if the moved-from state is well ordered with other values. Regards, &rzej;