Boost.Sort: boost::sort Namespace Reference

Boost.Sort

- Main Page
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Functions
boost::sort Namespace Reference

## Functions
template<class Data_type , class Cast_type >
Cast_type | float_mem_cast (const Data_type &data)
| Casts a float to the specified integer type. More...
template<class RandomAccessIter >
void | float_sort (RandomAccessIter first, RandomAccessIter last)
| `float_sort` with casting to the appropriate size. More...
template<class RandomAccessIter , class Right_shift >
void | float_sort (RandomAccessIter first, RandomAccessIter last, Right_shift rshift)
| Floating-point sort algorithm using random access iterators with just right-shift functor. More...
template<class RandomAccessIter , class Right_shift , class Compare >
void | float_sort (RandomAccessIter first, RandomAccessIter last, Right_shift rshift, Compare comp)
| Float sort algorithm using random access iterators with both right-shift and user-defined comparison operator. More...
template<class RandomAccessIter >
void | integer_sort (RandomAccessIter first, RandomAccessIter last)
| Integer sort algorithm using random access iterators. (All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`). More...
template<class RandomAccessIter , class Right_shift , class Compare >
void | integer_sort (RandomAccessIter first, RandomAccessIter last, Right_shift shift, Compare comp)
| Integer sort algorithm using random access iterators with both right-shift and user-defined comparison operator. (All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`). More...
template<class RandomAccessIter , class Right_shift >
void | integer_sort (RandomAccessIter first, RandomAccessIter last, Right_shift shift)
| Integer sort algorithm using random access iterators with just right-shift functor. (All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`). More...
template<class RandomAccessIter >
boost::enable_if_c< std::numeric_limits< typename std::iterator_traits< RandomAccessIter >::value_type >::is_integer, void >::type | spreadsort (RandomAccessIter first, RandomAccessIter last)
| Generic `spreadsort` variant detecting integer-type elements so call to `integer_sort`. More...
template<class RandomAccessIter >
boost::enable_if_c< !std::numeric_limits< typename std::iterator_traits< RandomAccessIter >::value_type >::is_integer &&std::numeric_limits< typename std::iterator_traits< RandomAccessIter >::value_type >::is_iec559, void >::type | spreadsort (RandomAccessIter first, RandomAccessIter last)
| Generic `spreadsort` variant detecting float element type so call to `float_sort`. More...
template<class RandomAccessIter >
boost::enable_if_c< is_same< typename std::iterator_traits< RandomAccessIter >::value_type, typename std::string >::value||is_same< typename std::iterator_traits< RandomAccessIter >::value_type, typename std::wstring >::value, void >::type | spreadsort (RandomAccessIter first, RandomAccessIter last)
| Generic `spreadsort` variant detecting string element type so call to `string_sort` for `std::strings` and `std::wstrings`. More...
template<class RandomAccessIter , class Unsigned_char_type >
void | string_sort (RandomAccessIter first, RandomAccessIter last, Unsigned_char_type unused)
| String sort algorithm using random access iterators, allowing character-type overloads. (All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`). More...
template<class RandomAccessIter >
void | string_sort (RandomAccessIter first, RandomAccessIter last)
| String sort algorithm using random access iterators, wraps using default of unsigned char. (All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`). More...
template<class RandomAccessIter , class Compare , class Unsigned_char_type >
void | reverse_string_sort (RandomAccessIter first, RandomAccessIter last, Compare comp, Unsigned_char_type unused)
| String sort algorithm using random access iterators, allowing character-type overloads. More...
template<class RandomAccessIter , class Compare >
void | reverse_string_sort (RandomAccessIter first, RandomAccessIter last, Compare comp)
| String sort algorithm using random access iterators, wraps using default of `unsigned` char. More...
template<class RandomAccessIter , class Get_char , class Get_length >
void | string_sort (RandomAccessIter first, RandomAccessIter last, Get_char get_character, Get_length length)
| String sort algorithm using random access iterators, wraps using default of `unsigned` char. More...
template<class RandomAccessIter , class Get_char , class Get_length , class Compare >
void | string_sort (RandomAccessIter first, RandomAccessIter last, Get_char get_character, Get_length length, Compare comp)
| String sort algorithm using random access iterators, wraps using default of `unsigned` char. More...
template<class RandomAccessIter , class Get_char , class Get_length , class Compare >
void | reverse_string_sort (RandomAccessIter first, RandomAccessIter last, Get_char get_character, Get_length length, Compare comp)
| Reverse String sort algorithm using random access iterators. More...

## Detailed Description

Namespace for spreadsort sort variants for different data types.

Note
  Use hyperlinks (coloured) to get detailed information about functions.

## Function Documentation

template<class Data_type , class Cast_type >

Cast_type boost::sort::float_mem_cast | ( | const Data_type & | data | ) |
| inline

Casts a float to the specified integer type.

Template Parameters

  Data_type | Floating-point IEEE 754/IEC559 type.
  Cast_type | Integer type (same size) to which to cast.

Example:
  struct rightshift {
  int operator()(const DATA_TYPE &x, const unsigned offset) const {
  return float_mem_cast<KEY_TYPE, CAST_TYPE>(x.key) >> offset;
  }
  };

template<class RandomAccessIter >

void boost::sort::float_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last
| ) |  |
| inline

`float_sort` with casting to the appropriate size.

Template Parameters

  RandomAccessIter | Random access iterator

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.

Some performance plots of runtime vs. n and log(range) are provided:
windows_float_sort
osx_float_sort

A simple example of sorting some floating-point is:
  vector<float> vec;
  vec.push_back(1.0);
  vec.push_back(2.3);
  vec.push_back(1.3);
  spreadsort(vec.begin(), vec.end());

The sorted vector contains ascending values "1.0 1.3 2.3".

template<class RandomAccessIter , class Right_shift >

void boost::sort::float_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Right_shift | rshift
| ) |  |
| inline

Floating-point sort algorithm using random access iterators with just right-shift functor.

Template Parameters

  RandomAccessIter | Random access iterator
  Right_shift | Functor for right-shift by parameter `shift` bits.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | rshift | Number of bits to right-shift (using functor).

template<class RandomAccessIter , class Right_shift , class Compare >

void boost::sort::float_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Right_shift | rshift,
|  | Compare | comp
| ) |  |
| inline

Float sort algorithm using random access iterators with both right-shift and user-defined comparison operator.

Template Parameters

  RandomAccessIter | Random access iterator
  Right_shift | functor for right-shift by parameter `shift` bits.
  Comp | To provide `operator<` for user-defined comparison.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | rshift | Number of bits to right-shift (using functor).
  [in] | comp | comparison functor.

template<class RandomAccessIter >

void boost::sort::integer_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last
| ) |  |
| inline

Integer sort algorithm using random access iterators. (All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`).

`integer_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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
Some performance plots of runtime vs. n and log(range) are provided:
windows_integer_sort
osx_integer_sort

Template Parameters

  RandomAccessIter | Random access iterator

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter , class Right_shift , class Compare >

void boost::sort::integer_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Right_shift | shift,
|  | Compare | comp
| ) |  |
| inline

Integer sort algorithm using random access iterators with both right-shift and user-defined comparison operator. (All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`).

`integer_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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
Some performance plots of runtime vs. n and log(range) are provided:
windows_integer_sort
osx_integer_sort

Template Parameters

  RandomAccessIter | Random access iterator
  Right_shift | functor for right-shift by parameter `shift` bits.
  Comp | To provide `operator<` for user-defined comparison.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | shift | Number of bits to right-shift (using functor).
  [in] | comp | comparison functor.

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Returns
  `void`.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter , class Right_shift >

void boost::sort::integer_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Right_shift | shift
| ) |  |
| inline

Integer sort algorithm using random access iterators with just right-shift functor. (All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`).

`integer_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).

Performance:
  Worst-case performance is O(N * (lg(range)/s + s)) , so `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
  Some performance plots of runtime vs. n and log(range) are provided:
  windows_integer_sort
  osx_integer_sort

Template Parameters

  RandomAccessIter | Random access iterator
  Right_shift | functor for right-shift by parameter `shift` bits.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | shift | Number of bits to right-shift (using functor).

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter , class Compare , class Unsigned_char_type >

void boost::sort::reverse_string_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Compare | comp,
|  | Unsigned_char_type | unused
| ) |  |
| inline

String sort algorithm using random access iterators, allowing character-type overloads.

(All variants fall back to `std::sort` if the data size is too small, < detail::min_sort_size).

`integer_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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
Some performance plots of runtime vs. n and log(range) are provided:
windows_integer_sort
osx_integer_sort

Template Parameters

  RandomAccessIter | Random access iterator
  Comp | To provide `operator<` for user-defined comparison.
  Unsigned_char_type | Unsigned character type used for string.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | comp | comparison functor.
  [in] | unused | Unused ???

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Returns
  `void`.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter , class Compare >

void boost::sort::reverse_string_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Compare | comp
| ) |  |
| inline

String sort algorithm using random access iterators, wraps using default of `unsigned` char.

(All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`).

`integer_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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
Some performance plots of runtime vs. n and log(range) are provided:
windows_integer_sort
osx_integer_sort

Template Parameters

  RandomAccessIter | Random access iterator
  Comp | To provide `operator<` for user-defined comparison.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | comp | Comparison functor.

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Returns
  `void`.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter , class Get_char , class Get_length , class Compare >

void boost::sort::reverse_string_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Get_char | get_character,
|  | Get_length | length,
|  | Compare | comp
| ) |  |
| inline

Reverse String sort algorithm using random access iterators.

(All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`).

`integer_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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
Some performance plots of runtime vs. n and log(range) are provided:
windows_integer_sort
osx_integer_sort

Template Parameters

  RandomAccessIter | Random access iterator
  Get_char | ???.
  Get_length | ??? TODO
  Comp | To provide `operator<` for user-defined comparison.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | comp | comparison functor.
  [in] | get_character | ???
  [in] | length | ???

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Returns
  `void`.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter >

boost::enable_if_c< std::numeric_limits< typename std::iterator_traits<RandomAccessIter>::value_type >::is_integer, void >::type boost::sort::spreadsort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last
| ) |  |
| inline

Generic `spreadsort` variant detecting integer-type elements so call to `integer_sort`.

If the data type provided is an integer, `integer_sort` is used.

Note
  Sorting other data types requires picking between `integer_sort`, `float_sort` and `string_sort` directly, as `spreadsort` won't accept types that don't have the appropriate `type_traits`.

Template Parameters

  RandomAccessIter | Random access iterator

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

template<class RandomAccessIter >

boost::enable_if_c< !std::numeric_limits< typename std::iterator_traits<RandomAccessIter>::value_type >::is_integer && std::numeric_limits< typename std::iterator_traits<RandomAccessIter>::value_type >::is_iec559, void >::type boost::sort::spreadsort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last
| ) |  |
| inline

Generic `spreadsort` variant detecting float element type so call to `float_sort`.

If the data type provided is a float or castable-float, `float_sort` is used.

Note
  Sorting other data types requires picking between `integer_sort`, `float_sort` and `string_sort` directly, as `spreadsort` won't accept types that don't have the appropriate `type_traits`.

Template Parameters

  RandomAccessIter | Random access iterator

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

template<class RandomAccessIter >

boost::enable_if_c< is_same<typename std::iterator_traits<RandomAccessIter>::value_type, typename std::string>::value || is_same<typename std::iterator_traits<RandomAccessIter>::value_type, typename std::wstring>::value, void >::type boost::sort::spreadsort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last
| ) |  |
| inline

Generic `spreadsort` variant detecting string element type so call to `string_sort` for `std::strings` and `std::wstrings`.

If the data type provided is a string or wstring, `string_sort` is used.

Note
  Sorting other data types requires picking between `integer_sort`, `float_sort` and `string_sort` directly, as `spreadsort` won't accept types that don't have the appropriate `type_traits`.

Template Parameters

  RandomAccessIter | Random access iterator

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

template<class RandomAccessIter , class Unsigned_char_type >

void boost::sort::string_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Unsigned_char_type | unused
| ) |  |
| inline

String sort algorithm using random access iterators, allowing character-type overloads.
(All variants fall back to `std::sort` 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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
  Some performance plots of runtime vs. n and log(range) are provided:
  windows_string_sort
  osx_string_sort

Template Parameters

  RandomAccessIter | Random access iterator
  Unsigned_char_type | Unsigned character type used for string.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | unused | Unused ???

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter >

void boost::sort::string_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last
| ) |  |
| inline

String sort algorithm using random access iterators, wraps using default of unsigned char. (All variants fall back to `std::sort` 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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
Some performance plots of runtime vs. n and log(range) are provided:
windows_string_sort
osx_string_sort

Template Parameters

  RandomAccessIter | Random access iterator

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter , class Get_char , class Get_length >

void boost::sort::string_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Get_char | get_character,
|  | Get_length | length
| ) |  |
| inline

String sort algorithm using random access iterators, wraps using default of `unsigned` char.

(All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`).

`integer_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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
Some performance plots of runtime vs. n and log(range) are provided:
windows_integer_sort
osx_integer_sort

Template Parameters

  RandomAccessIter | Random access iterator
  Get_char | Bracket functor equivalent to `operator`[], taking a number corresponding to the character offset..
  Get_length | Functor to get the length of the string in characters. TODO Check this and below and other places!!!

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | get_character | Number corresponding to the character offset from bracket functor equivalent to `operator`[].
  [in] | length | Functor to get the length of the string in characters.

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable
  `RandomAccessIter` `value_type` supports the `operator>>`, which returns an integer-type right-shifted a specified number of bits.

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Returns
  `void`.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).

template<class RandomAccessIter , class Get_char , class Get_length , class Compare >

void boost::sort::string_sort | ( | RandomAccessIter | first,
|  | RandomAccessIter | last,
|  | Get_char | get_character,
|  | Get_length | length,
|  | Compare | comp
| ) |  |
| inline

String sort algorithm using random access iterators, wraps using default of `unsigned` char.

(All variants fall back to `std::sort` if the data size is too small, < `detail::min_sort_size`).

`integer_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 `integer_sort` is asymptotically faster than pure comparison-based algorithms. `s` is `max_splits`, which defaults to 11, so its worst-case with default settings for 32-bit integers is O(N * ((32/11) slow radix-based iterations fast comparison-based iterations).
Some performance plots of runtime vs. n and log(range) are provided:
windows_integer_sort
osx_integer_sort

Template Parameters

  RandomAccessIter | Random access iterator
  Get_char | ???.
  Get_length | ??? TODO
  Comp | To provide `operator<` for user-defined comparison.

Parameters

  [in] | first | Iterator pointer to first element.
  [in] | last | Iterator pointing to one beyond the end of data.
  [in] | comp | comparison functor.
  [in] | get_character | ???
  [in] | length | ???

Precondition
  [`first`, `last`) is a valid range.
  `RandomAccessIter` `value_type` is mutable.
  `RandomAccessIter` `value_type` is LessThanComparable

Postcondition
  The elements in the range [`first`, `last`) are sorted in ascending order.

Returns
  `void`.

Exceptions

  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.

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.
  Invalid arguments cause undefined behaviour.

Note
  `spreadsort` function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.

Remarks
  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).