Boost logo

Boost :

Subject: Re: [boost] [outcome] Exception safety guarantees
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2017-05-30 15:43:46


On May 30, 2017, at 11:30 AM, Andrzej Krzemienski via Boost <boost_at_[hidden]> 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.

Howard




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk