|  | Home | Libraries | People | FAQ | More | 
boost::sort::spreadsort::reverse_string_sort — String sort algorithm using random access iterators, allowing character-type overloads.
// In header: <boost/sort/spreadsort/string_sort.hpp> template<typename RandomAccessIter, typename Compare, typename Unsigned_char_type> void reverse_string_sort(RandomAccessIter first, RandomAccessIter last, Compare comp, Unsigned_char_type unused);
(All variants fall back to boost::sort::pdqsort if the data size is too small, < detail::min_sort_size).
string_sort is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than std::sort for large tests (>=100kB).
 Worst-case performance is  O(N * (lg(range)/s + s)) , so string_sort is asymptotically faster than pure comparison-based algorithms. 
Some performance plots of runtime vs. n and log(range) are provided:
windows_string_sort
osx_string_sort
| ![[Warning]](../../../../../../../doc/src/images/warning.png) | Warning | 
|---|---|
| Throwing an exception may cause data loss. This will also throw if a small vector resize throws, in which case there will be no data loss. | 
| ![[Warning]](../../../../../../../doc/src/images/warning.png) | Warning | 
|---|---|
| Invalid arguments cause undefined behaviour. | 
| ![[Note]](../../../../../../../doc/src/images/note.png) | Note | 
|---|---|
| 
 | 
The lesser of O(N*log(N)) comparisons and O(N*log(K/S + S)) operations worst-case, where:
* N is last - first, 
* K is the log of the range in bits (32 for 32-bit integers using their full range),
* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size).
| Parameters: | 
 | ||||||||
| Template Parameters: | 
 | ||||||||
| Requires: | [ | ||||||||
| Requires: | 
 | ||||||||
| Requires: | 
 | ||||||||
| Requires: | 
 | ||||||||
| Postconditions: | The elements in the range [ | ||||||||
| Returns: | 
 | ||||||||
| Throws: | std::exception Propagates exceptions if any of the element comparisons, the element swaps (or moves), the right shift, subtraction of right-shifted elements, functors, or any operations on iterators throw. |