# Boost.Sort C++ Reference

Cast_type

Floating-point IEEE 754/IEC559 type.

Integer type (same size) to which to cast.

const Data_type &
Casts a float to the specified integer type.

# Example:

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

` `float_sort` with casting to the appropriate size.

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".

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

` `Right_shift

Functor that returns the result of shifting the value_type right a specified number of bits.

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

` `Right_shift

Functor that returns the result of shifting the value_type right a specified number of bits.

` `Compare

A binary functor that returns whether the first element passed to it should go before the second in order.

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

` 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

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.

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

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

[`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.

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

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

` `Right_shift

Functor that returns the result of shifting the value_type right a specified number of bits.

` `Compare

A binary functor that returns whether the first element passed to it should go before the second in order.

` 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

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.

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

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

[`first`, `last`) is a valid range.

`RandomAccessIter` `value_type` is mutable.

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

`void`.

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

` `Right_shift

A functor that returns the result of shifting the value_type right a specified number of bits.

` 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

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.

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

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

[`first`, `last`) is a valid range.

`RandomAccessIter` `value_type` is mutable.

`RandomAccessIter` `value_type` is LessThanComparable

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

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

boost::enable_if_c< std::numeric_limits< typename std::iterator_traits< RandomAccessIter >::value_type >::is_integer, void >::type `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

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

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

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

[`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.

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

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 `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

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

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

[`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.

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

boost::enable_if_c< is_same< typename std::iterator_traits< RandomAccessIter >::value_type, typename std::string >::value, void >::type `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

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

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

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

[`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.

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

boost::enable_if_c< is_same< typename std::iterator_traits< RandomAccessIter >::value_type, typename std::wstring >::value &&sizeof(wchar_t)==2, void >::type `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

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

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

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`. Also, 2-byte wide-characters are the limit above which string_sort is inefficient, so on platforms with wider characters, this will not accept wstrings.

[`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.

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

void

Random access iterator

Unsigned character type used for string.

RandomAccessIter

Iterator pointer to first element.

RandomAccessIter

Iterator pointing to one beyond the end of data.

Unsigned_char_type

value with the same type as the result of the [] operator, defining the Unsigned_char_type. The actual value is 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`).

`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

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.

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

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

[`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.

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

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

` 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

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.

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

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

[`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.

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

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

void

Random access iterator

Unsigned character type used for string.

RandomAccessIter

Iterator pointer to first element.

RandomAccessIter

Iterator pointing to one beyond the end of data.

Compare

A binary functor that returns whether the first element passed to it should go before the second in order.

Unsigned_char_type

value with the same type as the result of the [] operator, defining the Unsigned_char_type. The actual value is 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).

`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

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.

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

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

[`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.

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

`void`.

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

` `Compare

A binary functor that returns whether the first element passed to it should go before the second in order.

` 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

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.

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

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

[`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.

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

`void`.

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

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

` 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

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.

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

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

[`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.

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

`void`.

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

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

` `Compare

A binary functor that returns whether the first element passed to it should go before the second in order.

` 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

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.

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

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

[`first`, `last`) is a valid range.

`RandomAccessIter` `value_type` is mutable.

`RandomAccessIter` `value_type` is LessThanComparable

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

`void`.

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

void `RandomAccessIter

Iterator pointer to first element.

` `RandomAccessIter

Iterator pointing to one beyond the end of data.

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

` `Compare

A binary functor that returns whether the first element passed to it should go before the second in order.

` 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

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.

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

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

[`first`, `last`) is a valid range.

`RandomAccessIter` `value_type` is mutable.

`RandomAccessIter` `value_type` is LessThanComparable

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

`void`.

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