Sorry for top posting. I blame my portable device, manufacturer unnamed.
'range' is wrong and shouldn't be used, unless somehow qualified.
The things passed in are ranges, pairs of iterators are ranges, but
sort_subrange is using 'range' to mean the after-the-fact range. ie the
range that would be there after sorting. Yes it turns out to be the same
iterators, but it's confusing. I would think sort_subrange would only sort
the elements within the subrange (verb object - sort subrange) not sort
things from the total range _into_ the subrange.
So 'into' (or similar) might help. ie sort_into_subrange for the first
one. (just as a starting idea)
The second could be gather_into_subrange. Leaves you wondering what
criteria is used to select the gathering, but you'll check the docs instead
guessing incorrectly. (NOT understanding is better than MISunderstanding
when it comes to names)
I do like gather. And the association with nth element.
To be clear, the leftover elements on the left and right aren't even
partitioned? ie elements on the left could be greater than some elements on
the right?
Sent from my portable Analytical Engine
------------------------------
*From:* "Joaquín M López Munoz"
In Sean Parent's CppCon keynote last week, he went through the process of implementing an algorithm he called "sort_subrange", which takes four iterators describing two ranges, one a subset of the other, and sorts the subrange - as if you had sorted the entire range. (See https://www.youtube.com/watch?v=sWgDk-o-6ZE, starting at about 31:30).
I have implemented this in Boost.Algorithm (crediting Sean) - called partition_sort.
However, while I was doing this, I thought of a different algorithm; one that gathered all the elements into the subrange as if the entire range was sorted, but didn't actually do the sorting.
I've implemented that one, too - but I'm having a bit of trouble coming up with a name.
I've used "partition_subrange", but that not that clear. Sean has suggested "elements_in_subrange" and "elements_within_subrange".
The names you mention, being nouns rather than verbs, don't convey the notion that the algorithm performs a mutating action on the sequence. Some ideas: partition_gather gather_partition partition_group group_partition where "partition" can be used as an object (suffix) or a verb qualifier (prefix) Joaquín M López Muñoz Telefónica _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost