On 13 January 2017 at 09:51, Tim Song <t.canens....@gmail.com> wrote: >>> Wait, what throwing move? list::sort should be all splicing and no >>> moving, unless I missed something. >> >> It operates based on merge, which moves elements from one list to >> another using a throwing >> comparator. Undoing that operation is fairly tricky, because I don't >> know where the merged >> items landed. Splice is another move operation, but in case of splice, >> I would know where >> the items land, and it also doesn't throw, but merge does. > > But it must be in either the source or the destination, so any missing > elements have to be in one of the 65 temporary lists. Is there a
In some positions in one of those temporary lists. I don't know what positions those are. > problem with just going through all of them and splicing the contents > (if any) back to *this? Well, in addition to the computational complexity of it, not knowing which elements should be spliced back where. If a comparator given to sort() throws, trying to "unsort" with the same comparator can also throw, so I don't know how to reverse the operations done by that point.