autodoc.xml 91 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. <?xml version="1.0" standalone="yes"?>
  2. <library-reference id="boost_sort_c___reference"><title>Boost.Sort C++ Reference</title><header name="boost/sort/spreadsort/float_sort.hpp">
  3. <namespace name="boost">
  4. <namespace name="sort">
  5. <namespace name="spreadsort">
  6. <function name="float_mem_cast"><type>Cast_type</type><template>
  7. <template-type-parameter name="Data_type"><purpose><para>Floating-point IEEE 754/IEC559 type. </para></purpose></template-type-parameter>
  8. <template-type-parameter name="Cast_type"><purpose><para>Integer type (same size) to which to cast.</para></purpose></template-type-parameter>
  9. </template><parameter name="data"><paramtype>const Data_type &amp;</paramtype></parameter><purpose>Casts a float to the specified integer type. </purpose><description><para>
  10. <formalpara><title>Example:</title><para><programlisting language="c++">struct rightshift {
  11. int operator()(const DATA_TYPE &amp;x, const unsigned offset) const {
  12. return float_mem_cast&lt;KEY_TYPE, CAST_TYPE&gt;(x.key) &gt;&gt; offset;
  13. }
  14. };
  15. </programlisting> </para>
  16. </formalpara>
  17. </para></description></function>
  18. <function name="float_sort"><type>void</type><template>
  19. <template-type-parameter name="RandomAccessIter"/>
  20. </template><parameter name="first"><paramtype>RandomAccessIter</paramtype></parameter><parameter name="last"><paramtype>RandomAccessIter</paramtype></parameter><description><para>\brief @c float_sort with casting to the appropriate size.
  21. \param[in] first Iterator pointer to first element.
  22. \param[in] last Iterator pointing to one beyond the end of data.
  23. </para><para>Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  24. <ulink url="../../doc/graph/windows_float_sort.htm">windows_float_sort</ulink> <sbr/>
  25. <ulink url="../../doc/graph/osx_float_sort.htm">osx_float_sort</ulink></para><para><formalpara><title>A simple example of sorting some floating-point is:</title><para><programlisting language="c++">vector&lt;float&gt; vec;
  26. vec.push_back(1.0);
  27. vec.push_back(2.3);
  28. vec.push_back(1.3);
  29. spreadsort(vec.begin(), vec.end());
  30. </programlisting> </para>
  31. </formalpara>
  32. <formalpara><title>The sorted vector contains ascending values "1.0 1.3 2.3".</title><para/>
  33. </formalpara>
  34. </para></description></function>
  35. <function name="float_sort"><type>void</type><template>
  36. <template-type-parameter name="Range"/>
  37. </template><parameter name="range"><paramtype>Range &amp;</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><purpose>Floating-point sort algorithm using range. </purpose><description><para>
  38. </para></description></function>
  39. <function name="float_sort"><type>void</type><template>
  40. <template-type-parameter name="RandomAccessIter"/>
  41. <template-type-parameter name="Right_shift"/>
  42. </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="rshift"><paramtype>Right_shift</paramtype><description><para>Functor that returns the result of shifting the value_type right a specified number of bits. </para></description></parameter><purpose>Floating-point sort algorithm using random access iterators with just right-shift functor. </purpose><description><para>
  43. </para></description></function>
  44. <function name="float_sort"><type>void</type><template>
  45. <template-type-parameter name="Range"/>
  46. <template-type-parameter name="Right_shift"/>
  47. </template><parameter name="range"><paramtype>Range &amp;</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="rshift"><paramtype>Right_shift</paramtype><description><para>Functor that returns the result of shifting the value_type right a specified number of bits. </para></description></parameter><purpose>Floating-point sort algorithm using range with just right-shift functor. </purpose><description><para>
  48. </para></description></function>
  49. <function name="float_sort"><type>void</type><template>
  50. <template-type-parameter name="RandomAccessIter"/>
  51. <template-type-parameter name="Right_shift"/>
  52. <template-type-parameter name="Compare"/>
  53. </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="rshift"><paramtype>Right_shift</paramtype><description><para>Functor that returns the result of shifting the value_type right a specified number of bits. </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>Float sort algorithm using random access iterators with both right-shift and user-defined comparison operator. </purpose><description><para>
  54. </para></description></function>
  55. <function name="float_sort"><type>void</type><template>
  56. <template-type-parameter name="Range"/>
  57. <template-type-parameter name="Right_shift"/>
  58. <template-type-parameter name="Compare"/>
  59. </template><parameter name="range"><paramtype>Range &amp;</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="rshift"><paramtype>Right_shift</paramtype><description><para>Functor that returns the result of shifting the value_type right a specified number of bits. </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>Float sort algorithm using range with both right-shift and user-defined comparison operator. </purpose><description><para>
  60. </para></description></function>
  61. </namespace>
  62. </namespace>
  63. </namespace>
  64. </header>
  65. <header name="boost/sort/spreadsort/integer_sort.hpp">
  66. <namespace name="boost">
  67. <namespace name="sort">
  68. <namespace name="spreadsort">
  69. <function name="integer_sort"><type>void</type><template>
  70. <template-type-parameter name="RandomAccessIter"/>
  71. </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>Integer sort algorithm using random access iterators. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, &lt; <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>integer_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 (&gt;=100kB).<sbr/>
  72. Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>integer_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <computeroutput>s</computeroutput> is <computeroutput>max_splits</computeroutput>, which defaults to 11, so its worst-case with default settings for 32-bit integers is <emphasis> O(N * ((32/11) </emphasis> slow radix-based iterations fast comparison-based iterations).<sbr/>
  73. <sbr/>
  74. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  75. <ulink url="../../doc/graph/windows_integer_sort.htm">windows_integer_sort</ulink> <sbr/>
  76. <ulink url="../../doc/graph/osx_integer_sort.htm">osx_integer_sort</ulink></para><para>
  77. <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>
  78. </warning>
  79. <warning><para>Invalid arguments cause undefined behaviour. </para>
  80. </warning>
  81. <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>
  82. </note>
  83. <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>
  84. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  85. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  86. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  87. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  88. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  89. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  90. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  91. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  92. </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>
  93. <function name="integer_sort"><type>void</type><template>
  94. <template-type-parameter name="Range"/>
  95. </template><parameter name="range"><paramtype>Range &amp;</paramtype><description><para>Range [first, last) for sorting.</para></description></parameter><purpose>Integer sort algorithm using range. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, &lt; <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>integer_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 (&gt;=100kB).<sbr/>
  96. Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>integer_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <computeroutput>s</computeroutput> is <computeroutput>max_splits</computeroutput>, which defaults to 11, so its worst-case with default settings for 32-bit integers is <emphasis> O(N * ((32/11) </emphasis> slow radix-based iterations fast comparison-based iterations).<sbr/>
  97. <sbr/>
  98. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  99. <ulink url="../../doc/graph/windows_integer_sort.htm">windows_integer_sort</ulink> <sbr/>
  100. <ulink url="../../doc/graph/osx_integer_sort.htm">osx_integer_sort</ulink></para><para>
  101. <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>
  102. </warning>
  103. <warning><para>Invalid arguments cause undefined behaviour. </para>
  104. </warning>
  105. <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>
  106. </note>
  107. <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>
  108. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  109. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  110. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  111. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  112. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  113. </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>
  114. <function name="integer_sort"><type>void</type><template>
  115. <template-type-parameter name="RandomAccessIter"/>
  116. <template-type-parameter name="Right_shift"/>
  117. <template-type-parameter name="Compare"/>
  118. </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="shift"><paramtype>Right_shift</paramtype><description><para>Functor that returns the result of shifting the value_type right a specified number of bits. </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>Integer sort algorithm using random access iterators with both right-shift and user-defined comparison operator. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, &lt; <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>integer_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 (&gt;=100kB).<sbr/>
  119. Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>integer_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <computeroutput>s</computeroutput> is <computeroutput>max_splits</computeroutput>, which defaults to 11, so its worst-case with default settings for 32-bit integers is <emphasis> O(N * ((32/11) </emphasis> slow radix-based iterations fast comparison-based iterations).<sbr/>
  120. <sbr/>
  121. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  122. <ulink url="../../doc/graph/windows_integer_sort.htm">windows_integer_sort</ulink> <sbr/>
  123. <ulink url="../../doc/graph/osx_integer_sort.htm">osx_integer_sort</ulink></para><para>
  124. <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>
  125. </warning>
  126. <warning><para>Invalid arguments cause undefined behaviour. </para>
  127. </warning>
  128. <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>
  129. </note>
  130. <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>
  131. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  132. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  133. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  134. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  135. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  136. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  137. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  138. </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>
  139. <function name="integer_sort"><type>void</type><template>
  140. <template-type-parameter name="Range"/>
  141. <template-type-parameter name="Right_shift"/>
  142. <template-type-parameter name="Compare"/>
  143. </template><parameter name="range"><paramtype>Range &amp;</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="shift"><paramtype>Right_shift</paramtype><description><para>Functor that returns the result of shifting the value_type right a specified number of bits. </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>Integer sort algorithm using range with both right-shift and user-defined comparison operator. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, &lt; <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>integer_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 (&gt;=100kB).<sbr/>
  144. Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>integer_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <computeroutput>s</computeroutput> is <computeroutput>max_splits</computeroutput>, which defaults to 11, so its worst-case with default settings for 32-bit integers is <emphasis> O(N * ((32/11) </emphasis> slow radix-based iterations fast comparison-based iterations).<sbr/>
  145. <sbr/>
  146. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  147. <ulink url="../../doc/graph/windows_integer_sort.htm">windows_integer_sort</ulink> <sbr/>
  148. <ulink url="../../doc/graph/osx_integer_sort.htm">osx_integer_sort</ulink></para><para>
  149. <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>
  150. </warning>
  151. <warning><para>Invalid arguments cause undefined behaviour. </para>
  152. </warning>
  153. <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>
  154. </note>
  155. <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>
  156. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  157. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  158. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  159. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  160. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  161. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  162. </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>
  163. <function name="integer_sort"><type>void</type><template>
  164. <template-type-parameter name="RandomAccessIter"/>
  165. <template-type-parameter name="Right_shift"/>
  166. </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="shift"><paramtype>Right_shift</paramtype><description><para>A functor that returns the result of shifting the value_type right a specified number of bits.</para></description></parameter><purpose>Integer sort algorithm using random access iterators with just right-shift functor. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, &lt; <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>integer_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 (&gt;=100kB).<sbr/>
  167. <formalpara><title>Performance:</title><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>integer_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <computeroutput>s</computeroutput> is <computeroutput>max_splits</computeroutput>, which defaults to 11, so its worst-case with default settings for 32-bit integers is <emphasis> O(N * ((32/11) </emphasis> slow radix-based iterations fast comparison-based iterations).<sbr/>
  168. <sbr/>
  169. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  170. <ulink url="../../doc/graph/windows_integer_sort.htm">windows_integer_sort</ulink><sbr/>
  171. <ulink url="../../doc/graph/osx_integer_sort.htm">osx_integer_sort</ulink></para>
  172. </formalpara>
  173. <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>
  174. </warning>
  175. <warning><para>Invalid arguments cause undefined behaviour. </para>
  176. </warning>
  177. <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>
  178. </note>
  179. <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>
  180. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  181. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  182. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  183. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  184. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  185. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  186. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  187. </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>
  188. <function name="integer_sort"><type>void</type><template>
  189. <template-type-parameter name="Range"/>
  190. <template-type-parameter name="Right_shift"/>
  191. </template><parameter name="range"><paramtype>Range &amp;</paramtype><description><para>Range [first, last) for sorting. </para></description></parameter><parameter name="shift"><paramtype>Right_shift</paramtype><description><para>A functor that returns the result of shifting the value_type right a specified number of bits.</para></description></parameter><purpose>Integer sort algorithm using range with just right-shift functor. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, &lt; <computeroutput>detail::min_sort_size</computeroutput>). </purpose><description><para><computeroutput>integer_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 (&gt;=100kB).<sbr/>
  192. <formalpara><title>Performance:</title><para>Worst-case performance is <emphasis> O(N * (lg(range)/s + s)) </emphasis>, so <computeroutput>integer_sort</computeroutput> is asymptotically faster than pure comparison-based algorithms. <computeroutput>s</computeroutput> is <computeroutput>max_splits</computeroutput>, which defaults to 11, so its worst-case with default settings for 32-bit integers is <emphasis> O(N * ((32/11) </emphasis> slow radix-based iterations fast comparison-based iterations).<sbr/>
  193. <sbr/>
  194. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  195. <ulink url="../../doc/graph/windows_integer_sort.htm">windows_integer_sort</ulink><sbr/>
  196. <ulink url="../../doc/graph/osx_integer_sort.htm">osx_integer_sort</ulink></para>
  197. </formalpara>
  198. <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>
  199. </warning>
  200. <warning><para>Invalid arguments cause undefined behaviour. </para>
  201. </warning>
  202. <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>
  203. </note>
  204. <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>
  205. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  206. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  207. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  208. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  209. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  210. </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>
  211. </namespace>
  212. </namespace>
  213. </namespace>
  214. </header>
  215. <header name="boost/sort/spreadsort/spreadsort.hpp">
  216. <namespace name="boost">
  217. <namespace name="sort">
  218. <namespace name="spreadsort">
  219. <function name="spreadsort"><type>boost::enable_if_c&lt; std::numeric_limits&lt; typename std::iterator_traits&lt; RandomAccessIter &gt;::value_type &gt;::is_integer, void &gt;::type</type><template>
  220. <template-type-parameter name="RandomAccessIter"/>
  221. </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>Generic <computeroutput>spreadsort</computeroutput> variant detecting integer-type elements so call to <computeroutput>integer_sort</computeroutput>. </purpose><description><para>If the data type provided is an integer, <computeroutput>integer_sort</computeroutput> is used. <note><para>Sorting other data types requires picking between <computeroutput>integer_sort</computeroutput>, <computeroutput>float_sort</computeroutput> and <computeroutput>string_sort</computeroutput> directly, as <computeroutput>spreadsort</computeroutput> won't accept types that don't have the appropriate <computeroutput>type_traits</computeroutput>. </para>
  222. </note>
  223. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  224. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  225. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  226. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  227. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order. </para>
  228. </postconditions></function>
  229. <function name="spreadsort"><type>boost::enable_if_c&lt; !std::numeric_limits&lt; typename std::iterator_traits&lt; RandomAccessIter &gt;::value_type &gt;::is_integer &amp;&amp;std::numeric_limits&lt; typename std::iterator_traits&lt; RandomAccessIter &gt;::value_type &gt;::is_iec559, void &gt;::type</type><template>
  230. <template-type-parameter name="RandomAccessIter"/>
  231. </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>Generic <computeroutput>spreadsort</computeroutput> variant detecting float element type so call to <computeroutput>float_sort</computeroutput>. </purpose><description><para>If the data type provided is a float or castable-float, <computeroutput>float_sort</computeroutput> is used. <note><para>Sorting other data types requires picking between <computeroutput>integer_sort</computeroutput>, <computeroutput>float_sort</computeroutput> and <computeroutput>string_sort</computeroutput> directly, as <computeroutput>spreadsort</computeroutput> won't accept types that don't have the appropriate <computeroutput>type_traits</computeroutput>.</para>
  232. </note>
  233. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  234. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  235. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  236. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  237. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order. </para>
  238. </postconditions></function>
  239. <function name="spreadsort"><type>boost::enable_if_c&lt; is_same&lt; typename std::iterator_traits&lt; RandomAccessIter &gt;::value_type, typename std::string &gt;::value, void &gt;::type</type><template>
  240. <template-type-parameter name="RandomAccessIter"/>
  241. </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>Generic <computeroutput>spreadsort</computeroutput> variant detecting string element type so call to <computeroutput>string_sort</computeroutput> for <computeroutput>std::strings</computeroutput>. </purpose><description><para>If the data type provided is a string, <computeroutput>string_sort</computeroutput> is used. <note><para>Sorting other data types requires picking between <computeroutput>integer_sort</computeroutput>, <computeroutput>float_sort</computeroutput> and <computeroutput>string_sort</computeroutput> directly, as <computeroutput>spreadsort</computeroutput> won't accept types that don't have the appropriate <computeroutput>type_traits</computeroutput>.</para>
  242. </note>
  243. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  244. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  245. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  246. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  247. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order. </para>
  248. </postconditions></function>
  249. <function name="spreadsort"><type>boost::enable_if_c&lt; is_same&lt; typename std::iterator_traits&lt; RandomAccessIter &gt;::value_type, typename std::wstring &gt;::value &amp;&amp;sizeof(wchar_t)==2, void &gt;::type</type><template>
  250. <template-type-parameter name="RandomAccessIter"/>
  251. </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>Generic <computeroutput>spreadsort</computeroutput> variant detecting string element type so call to <computeroutput>string_sort</computeroutput> for <computeroutput>std::wstrings</computeroutput>. </purpose><description><para>If the data type provided is a wstring, <computeroutput>string_sort</computeroutput> is used. <note><para>Sorting other data types requires picking between <computeroutput>integer_sort</computeroutput>, <computeroutput>float_sort</computeroutput> and <computeroutput>string_sort</computeroutput> directly, as <computeroutput>spreadsort</computeroutput> won't accept types that don't have the appropriate <computeroutput>type_traits</computeroutput>. 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.</para>
  252. </note>
  253. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  254. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  255. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  256. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  257. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order. </para>
  258. </postconditions></function>
  259. <function name="spreadsort"><type>void</type><template>
  260. <template-type-parameter name="Range"/>
  261. </template><parameter name="range"><paramtype>Range &amp;</paramtype><description><para>Range [first, last) for sorting.</para></description></parameter><purpose>Generic <computeroutput>spreadsort</computeroutput> variant detects value_type and calls required sort function. </purpose><description><para><note><para>Sorting other data types requires picking between <computeroutput>integer_sort</computeroutput>, <computeroutput>float_sort</computeroutput> and <computeroutput>string_sort</computeroutput> directly, as <computeroutput>spreadsort</computeroutput> won't accept types that don't have the appropriate <computeroutput>type_traits</computeroutput>.</para>
  262. </note>
  263. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  264. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order. </para>
  265. </postconditions></function>
  266. </namespace>
  267. </namespace>
  268. </namespace>
  269. </header>
  270. <header name="boost/sort/spreadsort/string_sort.hpp">
  271. <namespace name="boost">
  272. <namespace name="sort">
  273. <namespace name="spreadsort">
  274. <function name="string_sort"><type>void</type><template>
  275. <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>
  276. <template-type-parameter name="Unsigned_char_type"><purpose><para>Unsigned character type used for string. </para></purpose></template-type-parameter>
  277. </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="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.<sbr/>
  278. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, &lt; <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 (&gt;=100kB).<sbr/>
  279. <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/>
  280. <sbr/>
  281. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  282. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  283. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  284. </formalpara>
  285. <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>
  286. </warning>
  287. <warning><para>Invalid arguments cause undefined behaviour. </para>
  288. </warning>
  289. <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>
  290. </note>
  291. <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>
  292. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  293. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  294. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  295. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  296. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  297. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  298. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  299. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  300. </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>
  301. <function name="string_sort"><type>void</type><template>
  302. <template-type-parameter name="Range"/>
  303. <template-type-parameter name="Unsigned_char_type"><purpose><para>Unsigned character type used for string. </para></purpose></template-type-parameter>
  304. </template><parameter name="range"><paramtype>Range &amp;</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/>
  305. (All variants fall back to <computeroutput>boost::sort::pdqsort</computeroutput> if the data size is too small, &lt; <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 (&gt;=100kB).<sbr/>
  306. <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/>
  307. <sbr/>
  308. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  309. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  310. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  311. </formalpara>
  312. <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>
  313. </warning>
  314. <warning><para>Invalid arguments cause undefined behaviour. </para>
  315. </warning>
  316. <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>
  317. </note>
  318. <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>
  319. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  320. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  321. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  322. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  323. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  324. </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>
  325. <function name="string_sort"><type>void</type><template>
  326. <template-type-parameter name="RandomAccessIter"/>
  327. </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, &lt; <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 (&gt;=100kB).<sbr/>
  328. 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/>
  329. <sbr/>
  330. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  331. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink> <sbr/>
  332. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para><para>
  333. <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>
  334. </warning>
  335. <warning><para>Invalid arguments cause undefined behaviour. </para>
  336. </warning>
  337. <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>
  338. </note>
  339. <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>
  340. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  341. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  342. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  343. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  344. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  345. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  346. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  347. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  348. </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>
  349. <function name="string_sort"><type>void</type><template>
  350. <template-type-parameter name="Range"/>
  351. </template><parameter name="range"><paramtype>Range &amp;</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, &lt; <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 (&gt;=100kB).<sbr/>
  352. 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/>
  353. <sbr/>
  354. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  355. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink> <sbr/>
  356. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para><para>
  357. <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>
  358. </warning>
  359. <warning><para>Invalid arguments cause undefined behaviour. </para>
  360. </warning>
  361. <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>
  362. </note>
  363. <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>
  364. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  365. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  366. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  367. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  368. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  369. </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>
  370. <function name="reverse_string_sort"><type>void</type><template>
  371. <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>
  372. <template-type-parameter name="Compare"/>
  373. <template-type-parameter name="Unsigned_char_type"><purpose><para>Unsigned character type used for string.</para></purpose></template-type-parameter>
  374. </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, &lt; 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 (&gt;=100kB).<sbr/>
  375. <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/>
  376. <sbr/>
  377. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  378. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  379. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  380. </formalpara>
  381. <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>
  382. </warning>
  383. <warning><para>Invalid arguments cause undefined behaviour. </para>
  384. </warning>
  385. <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>
  386. </note>
  387. <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>
  388. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  389. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  390. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  391. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  392. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  393. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  394. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  395. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  396. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  397. </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>
  398. <function name="reverse_string_sort"><type>void</type><template>
  399. <template-type-parameter name="Range"/>
  400. <template-type-parameter name="Compare"/>
  401. <template-type-parameter name="Unsigned_char_type"><purpose><para>Unsigned character type used for string.</para></purpose></template-type-parameter>
  402. </template><parameter name="range"><paramtype>Range &amp;</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, &lt; 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 (&gt;=100kB).<sbr/>
  403. 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/>
  404. <sbr/>
  405. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  406. <ulink url="../../doc/graph/windows_integer_sort.htm">windows_integer_sort</ulink> <sbr/>
  407. <ulink url="../../doc/graph/osx_integer_sort.htm">osx_integer_sort</ulink></para><para>
  408. <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>
  409. </warning>
  410. <warning><para>Invalid arguments cause undefined behaviour. </para>
  411. </warning>
  412. <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>
  413. </note>
  414. <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>
  415. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  416. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  417. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  418. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  419. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  420. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  421. </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>
  422. <function name="reverse_string_sort"><type>void</type><template>
  423. <template-type-parameter name="RandomAccessIter"/>
  424. <template-type-parameter name="Compare"/>
  425. </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, &lt; <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 (&gt;=100kB).<sbr/>
  426. <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/>
  427. <sbr/>
  428. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  429. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  430. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  431. </formalpara>
  432. <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>
  433. </warning>
  434. <warning><para>Invalid arguments cause undefined behaviour. </para>
  435. </warning>
  436. <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>
  437. </note>
  438. <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>
  439. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  440. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  441. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  442. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  443. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  444. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  445. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  446. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  447. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  448. </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>
  449. <function name="reverse_string_sort"><type>void</type><template>
  450. <template-type-parameter name="Range"/>
  451. <template-type-parameter name="Compare"/>
  452. </template><parameter name="range"><paramtype>Range &amp;</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, &lt; <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 (&gt;=100kB).<sbr/>
  453. <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/>
  454. <sbr/>
  455. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  456. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  457. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  458. </formalpara>
  459. <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>
  460. </warning>
  461. <warning><para>Invalid arguments cause undefined behaviour. </para>
  462. </warning>
  463. <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>
  464. </note>
  465. <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>
  466. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  467. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  468. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  469. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  470. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  471. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  472. </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>
  473. <function name="string_sort"><type>void</type><template>
  474. <template-type-parameter name="RandomAccessIter"/>
  475. <template-type-parameter name="Get_char"/>
  476. <template-type-parameter name="Get_length"/>
  477. </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, &lt; <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 (&gt;=100kB).<sbr/>
  478. <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/>
  479. <sbr/>
  480. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  481. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  482. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  483. </formalpara>
  484. <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>
  485. </warning>
  486. <warning><para>Invalid arguments cause undefined behaviour. </para>
  487. </warning>
  488. <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>
  489. </note>
  490. <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>
  491. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  492. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  493. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  494. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  495. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  496. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  497. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> supports the <computeroutput>operator&gt;&gt;</computeroutput>, which returns an integer-type right-shifted a specified number of bits. </para>
  498. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  499. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  500. </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>
  501. <function name="string_sort"><type>void</type><template>
  502. <template-type-parameter name="Range"/>
  503. <template-type-parameter name="Get_char"/>
  504. <template-type-parameter name="Get_length"/>
  505. </template><parameter name="range"><paramtype>Range &amp;</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, &lt; <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 (&gt;=100kB).<sbr/>
  506. <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/>
  507. <sbr/>
  508. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  509. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  510. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  511. </formalpara>
  512. <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>
  513. </warning>
  514. <warning><para>Invalid arguments cause undefined behaviour. </para>
  515. </warning>
  516. <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>
  517. </note>
  518. <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>
  519. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  520. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  521. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  522. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  523. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  524. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  525. </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>
  526. <function name="string_sort"><type>void</type><template>
  527. <template-type-parameter name="RandomAccessIter"/>
  528. <template-type-parameter name="Get_char"/>
  529. <template-type-parameter name="Get_length"/>
  530. <template-type-parameter name="Compare"/>
  531. </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, &lt; <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 (&gt;=100kB).<sbr/>
  532. <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/>
  533. <sbr/>
  534. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  535. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  536. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  537. </formalpara>
  538. <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>
  539. </warning>
  540. <warning><para>Invalid arguments cause undefined behaviour. </para>
  541. </warning>
  542. <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>
  543. </note>
  544. <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>
  545. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  546. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  547. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  548. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  549. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  550. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  551. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  552. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  553. </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>
  554. <function name="string_sort"><type>void</type><template>
  555. <template-type-parameter name="Range"/>
  556. <template-type-parameter name="Get_char"/>
  557. <template-type-parameter name="Get_length"/>
  558. <template-type-parameter name="Compare"/>
  559. </template><parameter name="range"><paramtype>Range &amp;</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, &lt; <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 (&gt;=100kB).<sbr/>
  560. <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/>
  561. <sbr/>
  562. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  563. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  564. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  565. </formalpara>
  566. <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>
  567. </warning>
  568. <warning><para>Invalid arguments cause undefined behaviour. </para>
  569. </warning>
  570. <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>
  571. </note>
  572. <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>
  573. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  574. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  575. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  576. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  577. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  578. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  579. </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>
  580. <function name="reverse_string_sort"><type>void</type><template>
  581. <template-type-parameter name="RandomAccessIter"/>
  582. <template-type-parameter name="Get_char"/>
  583. <template-type-parameter name="Get_length"/>
  584. <template-type-parameter name="Compare"/>
  585. </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, &lt; <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 (&gt;=100kB).<sbr/>
  586. <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/>
  587. <sbr/>
  588. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  589. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  590. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  591. </formalpara>
  592. <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>
  593. </warning>
  594. <warning><para>Invalid arguments cause undefined behaviour. </para>
  595. </warning>
  596. <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>
  597. </note>
  598. <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>
  599. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  600. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  601. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  602. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  603. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is mutable. </para>
  604. </requires><requires><para><computeroutput>RandomAccessIter</computeroutput> <computeroutput>value_type</computeroutput> is <ulink url="http://en.cppreference.com/w/cpp/concept/LessThanComparable">LessThanComparable</ulink> </para>
  605. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  606. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  607. </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>
  608. <function name="reverse_string_sort"><type>void</type><template>
  609. <template-type-parameter name="Range"/>
  610. <template-type-parameter name="Get_char"/>
  611. <template-type-parameter name="Get_length"/>
  612. <template-type-parameter name="Compare"/>
  613. </template><parameter name="range"><paramtype>Range &amp;</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, &lt; <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 (&gt;=100kB).<sbr/>
  614. <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/>
  615. <sbr/>
  616. Some performance plots of runtime vs. n and log(range) are provided:<sbr/>
  617. <ulink url="../../doc/graph/windows_string_sort.htm">windows_string_sort</ulink><sbr/>
  618. <ulink url="../../doc/graph/osx_string_sort.htm">osx_string_sort</ulink></para>
  619. </formalpara>
  620. <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>
  621. </warning>
  622. <warning><para>Invalid arguments cause undefined behaviour. </para>
  623. </warning>
  624. <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>
  625. </note>
  626. <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>
  627. <para>* N is <computeroutput>last</computeroutput> - <computeroutput>first</computeroutput>, </para>
  628. <para>* K is the log of the range in bits (32 for 32-bit integers using their full range), </para>
  629. <para>* S is a constant called max_splits, defaulting to 11 (except for strings where it is the log of the character size). </para>
  630. </para></description><requires><para>[<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) is a valid range. </para>
  631. </requires><postconditions><para>The elements in the range [<computeroutput>first</computeroutput>, <computeroutput>last</computeroutput>) are sorted in ascending order.</para>
  632. </postconditions><returns><para><computeroutput>void</computeroutput>.</para>
  633. </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>
  634. </namespace>
  635. </namespace>
  636. </namespace>
  637. </header>
  638. </library-reference>