Boost.Sort C++ Reference
Cast_typeconst 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; } }; voidRandomAccessIterRandomAccessIter\brief @c float_sort with casting to the appropriate size. \param[in] first Iterator pointer to first element. \param[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_sortA 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". voidRange &Range [first, last) for sorting. Floating-point sort algorithm using range. voidRandomAccessIterIterator pointer to first element. RandomAccessIterIterator pointing to one beyond the end of data. Right_shiftFunctor 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. voidRange &Range [first, last) for sorting. Right_shiftFunctor that returns the result of shifting the value_type right a specified number of bits. Floating-point sort algorithm using range with just right-shift functor. voidRandomAccessIterIterator pointer to first element. RandomAccessIterIterator pointing to one beyond the end of data. Right_shiftFunctor that returns the result of shifting the value_type right a specified number of bits. CompareA 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. voidRange &Range [first, last) for sorting. Right_shiftFunctor that returns the result of shifting the value_type right a specified number of bits. CompareA binary functor that returns whether the first element passed to it should go before the second in order. Float sort algorithm using range with both right-shift and user-defined comparison operator.
voidRandomAccessIterIterator pointer to first element. RandomAccessIterIterator pointing to one beyond the end of data.Integer sort algorithm using random access iterators. (All variants fall back to boost::sort::pdqsort 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. voidRange &Range [first, last) for sorting.Integer sort algorithm using range. (All variants fall back to boost::sort::pdqsort 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. 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. voidRandomAccessIterIterator pointer to first element. RandomAccessIterIterator pointing to one beyond the end of data. Right_shiftFunctor that returns the result of shifting the value_type right a specified number of bits. CompareA 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 boost::sort::pdqsort 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. voidRange &Range [first, last) for sorting. Right_shiftFunctor that returns the result of shifting the value_type right a specified number of bits. CompareA binary functor that returns whether the first element passed to it should go before the second in order.Integer sort algorithm using range with both right-shift and user-defined comparison operator. (All variants fall back to boost::sort::pdqsort 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. 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. voidRandomAccessIterIterator pointer to first element. RandomAccessIterIterator pointing to one beyond the end of data. Right_shiftA 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 boost::sort::pdqsort 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. voidRange &Range [first, last) for sorting. Right_shiftA functor that returns the result of shifting the value_type right a specified number of bits.Integer sort algorithm using range with just right-shift functor. (All variants fall back to boost::sort::pdqsort 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. 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 >::typeRandomAccessIterIterator pointer to first element. RandomAccessIterIterator 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 >::typeRandomAccessIterIterator pointer to first element. RandomAccessIterIterator 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 >::typeRandomAccessIterIterator pointer to first element. RandomAccessIterIterator 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 >::typeRandomAccessIterIterator pointer to first element. RandomAccessIterIterator 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. voidRange &Range [first, last) for sorting.Generic spreadsort variant detects value_type and calls required sort function. 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. The elements in the range [first, last) are sorted in ascending order.
voidRandomAccessIterIterator pointer to first element. RandomAccessIterIterator pointing to one beyond the end of data. Unsigned_char_typevalue 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 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). <para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator>></computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="string_sort"><type>void</type><template> <template-type-parameter name="Range"/> <template-type-parameter name="Unsigned_char_type"><purpose><para>Unsigned character type used for string. </para></purpose></template-type-parameter> </template><parameter name="range"><paramtype>Range &</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="unused"><paramtype>Unsigned_char_type</paramtype><description><para>value with the same type as the result of the [] operator, defining the Unsigned_char_type. The actual value is unused.</para></description></parameter><purpose>String sort algorithm using range, allowing character-type overloads.<sbr/> (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="string_sort"><type>void</type><template> <template-type-parameter name="RandomAccessIter"/> </template><parameter name="first"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointer to first element. </para></description></parameter><parameter name="last"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointing to one beyond the end of data.</para></description></parameter><purpose>String sort algorithm using random access iterators, wraps using default of unsigned char. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink> <sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para><para> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator>></computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="string_sort"><type>void</type><template> <template-type-parameter name="Range"/> </template><parameter name="range"><paramtype>Range &</paramtype><description><para>Range [first, last) for sorting.</para></description></parameter><purpose>String sort algorithm using range, wraps using default of unsigned char. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink> <sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para><para> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="reverse_string_sort"><type>void</type><template> <template-type-parameter name="RandomAccessIter"><purpose><para><ulink url="http://www.cplusplus.com/reference/iterator/RandomAccessIterator/">Random access iterator</ulink> </para></purpose></template-type-parameter> <template-type-parameter name="Compare"/> <template-type-parameter name="Unsigned_char_type"><purpose><para>Unsigned character type used for string.</para></purpose></template-type-parameter> </template><parameter name="first"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointer to first element. </para></description></parameter><parameter name="last"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointing to one beyond the end of data. </para></description></parameter><parameter name="comp"><paramtype>Compare</paramtype><description><para>A binary functor that returns whether the first element passed to it should go before the second in order. </para></description></parameter><parameter name="unused"><paramtype>Unsigned_char_type</paramtype><description><para>value with the same type as the result of the [] operator, defining the Unsigned_char_type. The actual value is unused.</para></description></parameter><purpose>String sort algorithm using random access iterators, allowing character-type overloads. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < detail::min_sort_size).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator>></computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="reverse_string_sort"><type>void</type><template> <template-type-parameter name="Range"/> <template-type-parameter name="Compare"/> <template-type-parameter name="Unsigned_char_type"><purpose><para>Unsigned character type used for string.</para></purpose></template-type-parameter> </template><parameter name="range"><paramtype>Range &</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="comp"><paramtype>Compare</paramtype><description><para>A binary functor that returns whether the first element passed to it should go before the second in order. </para></description></parameter><parameter name="unused"><paramtype>Unsigned_char_type</paramtype><description><para>value with the same type as the result of the [] operator, defining the Unsigned_char_type. The actual value is unused.</para></description></parameter><purpose>String sort algorithm using range, allowing character-type overloads. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < detail::min_sort_size).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_integer_sort.htm">windows_integer_sort</ulink> <sbr/> <ulink url="../../doc/graph/osx_integer_sort.htm">osx_integer_sort</ulink></para><para> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="reverse_string_sort"><type>void</type><template> <template-type-parameter name="RandomAccessIter"/> <template-type-parameter name="Compare"/> </template><parameter name="first"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointer to first element. </para></description></parameter><parameter name="last"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointing to one beyond the end of data. </para></description></parameter><parameter name="comp"><paramtype>Compare</paramtype><description><para>A binary functor that returns whether the first element passed to it should go before the second in order.</para></description></parameter><purpose>String sort algorithm using random access iterators, wraps using default of <computeroutput>unsigned</computeroutput> char. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms.<sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator>></computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="reverse_string_sort"><type>void</type><template> <template-type-parameter name="Range"/> <template-type-parameter name="Compare"/> </template><parameter name="range"><paramtype>Range &</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="comp"><paramtype>Compare</paramtype><description><para>A binary functor that returns whether the first element passed to it should go before the second in order.</para></description></parameter><purpose>String sort algorithm using range, wraps using default of <computeroutput>unsigned</computeroutput> char. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="string_sort"><type>void</type><template> <template-type-parameter name="RandomAccessIter"/> <template-type-parameter name="Get_char"/> <template-type-parameter name="Get_length"/> </template><parameter name="first"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointer to first element. </para></description></parameter><parameter name="last"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointing to one beyond the end of data. </para></description></parameter><parameter name="get_character"><paramtype>Get_char</paramtype><description><para>Bracket functor equivalent to <computeroutput>operator</computeroutput>[], taking a number corresponding to the character offset. </para></description></parameter><parameter name="length"><paramtype>Get_length</paramtype><description><para>Functor to get the length of the string in characters.</para></description></parameter><purpose>String sort algorithm using random access iterators, wraps using default of <computeroutput>unsigned</computeroutput> char. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator>></computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="string_sort"><type>void</type><template> <template-type-parameter name="Range"/> <template-type-parameter name="Get_char"/> <template-type-parameter name="Get_length"/> </template><parameter name="range"><paramtype>Range &</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="get_character"><paramtype>Get_char</paramtype><description><para>Bracket functor equivalent to <computeroutput>operator</computeroutput>[], taking a number corresponding to the character offset. </para></description></parameter><parameter name="length"><paramtype>Get_length</paramtype><description><para>Functor to get the length of the string in characters.</para></description></parameter><purpose>String sort algorithm using range, wraps using default of <computeroutput>unsigned</computeroutput> char. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="string_sort"><type>void</type><template> <template-type-parameter name="RandomAccessIter"/> <template-type-parameter name="Get_char"/> <template-type-parameter name="Get_length"/> <template-type-parameter name="Compare"/> </template><parameter name="first"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointer to first element. </para></description></parameter><parameter name="last"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointing to one beyond the end of data. </para></description></parameter><parameter name="get_character"><paramtype>Get_char</paramtype><description><para>Bracket functor equivalent to <computeroutput>operator</computeroutput>[], taking a number corresponding to the character offset. </para></description></parameter><parameter name="length"><paramtype>Get_length</paramtype><description><para>Functor to get the length of the string in characters. </para></description></parameter><parameter name="comp"><paramtype>Compare</paramtype><description><para>A binary functor that returns whether the first element passed to it should go before the second in order.</para></description></parameter><purpose>String sort algorithm using random access iterators, wraps using default of <computeroutput>unsigned</computeroutput> char. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="string_sort"><type>void</type><template> <template-type-parameter name="Range"/> <template-type-parameter name="Get_char"/> <template-type-parameter name="Get_length"/> <template-type-parameter name="Compare"/> </template><parameter name="range"><paramtype>Range &</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="get_character"><paramtype>Get_char</paramtype><description><para>Bracket functor equivalent to <computeroutput>operator</computeroutput>[], taking a number corresponding to the character offset. </para></description></parameter><parameter name="length"><paramtype>Get_length</paramtype><description><para>Functor to get the length of the string in characters. </para></description></parameter><parameter name="comp"><paramtype>Compare</paramtype><description><para>A binary functor that returns whether the first element passed to it should go before the second in order.</para></description></parameter><purpose>String sort algorithm using range, wraps using default of <computeroutput>unsigned</computeroutput> char. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="reverse_string_sort"><type>void</type><template> <template-type-parameter name="RandomAccessIter"/> <template-type-parameter name="Get_char"/> <template-type-parameter name="Get_length"/> <template-type-parameter name="Compare"/> </template><parameter name="first"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointer to first element. </para></description></parameter><parameter name="last"><paramtype>RandomAccessIter</paramtype><description><para>Iterator pointing to one beyond the end of data. </para></description></parameter><parameter name="get_character"><paramtype>Get_char</paramtype><description><para>Bracket functor equivalent to <computeroutput>operator</computeroutput>[], taking a number corresponding to the character offset. </para></description></parameter><parameter name="length"><paramtype>Get_length</paramtype><description><para>Functor to get the length of the string in characters. </para></description></parameter><parameter name="comp"><paramtype>Compare</paramtype><description><para>A binary functor that returns whether the first element passed to it should go before the second in order.</para></description></parameter><purpose>Reverse String sort algorithm using random access iterators. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para> </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> <function name="reverse_string_sort"><type>void</type><template> <template-type-parameter name="Range"/> <template-type-parameter name="Get_char"/> <template-type-parameter name="Get_length"/> <template-type-parameter name="Compare"/> </template><parameter name="range"><paramtype>Range &</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="get_character"><paramtype>Get_char</paramtype><description><para>Bracket functor equivalent to <computeroutput>operator</computeroutput>[], taking a number corresponding to the character offset. </para></description></parameter><parameter name="length"><paramtype>Get_length</paramtype><description><para>Functor to get the length of the string in characters. </para></description></parameter><parameter name="comp"><paramtype>Compare</paramtype><description><para>A binary functor that returns whether the first element passed to it should go before the second in order.</para></description></parameter><purpose>Reverse String sort algorithm using range. </purpose><description><para>(All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, < <computeroutput>detail::min_sort_size</computeroutput>).</para><para><computeroutput>string_sort</computeroutput> is a fast templated in-place hybrid radix/comparison algorithm, which in testing tends to be roughly 50% to 2X faster than <computeroutput>std::sort</computeroutput> for large tests (>=100kB).<sbr/> <formalpara><title/><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>string_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <sbr/> <sbr/> Some performance plots of runtime vs. n and log(range) are provided:<sbr/> <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/> <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para> </formalpara> <warning><para>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. </para> </warning> <warning><para>Invalid arguments cause undefined behaviour. </para> </warning> <note><para><computeroutput>spreadsort</computeroutput> function provides a wrapper that calls the fastest sorting algorithm available for a data type, enabling faster generic-programming.</para> </note> <para>The lesser of <emphasis> O(N*log(N)) </emphasis> comparisons and <emphasis> O(N*log(K/S + S)) </emphasis>operations worst-case, where: </para> <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para> <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para> <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para> </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para> </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para> </postconditions><returns><para><computeroutput>void</computeroutput>.</para> </returns><throws><simpara><classname>std::exception</classname> 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.</simpara></throws></function> </namespace> </namespace> </namespace> </header> </library-reference>