⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 all.html

📁 从www.CppReference.com打包的C++参考手册
💻 HTML
📖 第 1 页 / 共 5 页
字号:
  bool next_permutation( iterator start, iterator end );  bool next_permutation( iterator start, iterator end, StrictWeakOrdering cmp );</pre>  <p>The next_permutation() function attempts to transform the given  range of elements [<em>start</em>,<em>end</em>) into the next  lexicographically greater permutation of elements. If it succeeds, it  returns true, otherwise, it returns false.</p>  <p>If a strict weak ordering function object <em>cmp</em> is  provided, it is used in lieu of the &lt; operator when comparing  elements.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="prev_permutation.html">prev_permutation</a><br>    <a href="random_sample.html">random_sample</a><br>    <a href="random_sample_n.html">random_sample_n</a><br>    <a href="random_shuffle.html">random_shuffle</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    nth_element  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  void nth_element( iterator start, iterator middle, iterator end );  void nth_element( iterator start, iterator middle, iterator end, StrictWeakOrdering cmp );</pre>  <p>The nth_element() function semi-sorts the range of elements  defined by [<em>start</em>,<em>end</em>). It puts the element that  <em>middle</em> points to in the place that it would be if the entire  range was sorted, and it makes sure that none of the elements before  that element are greater than any of the elements that come after  that element.</p>  <p>nth_element() runs in <a href="../complexity.html">linear time</a>  on average.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="partial_sort.html">partial_sort</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    partial_sort  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  void partial_sort( iterator start, iterator middle, iterator end );  void partial_sort( iterator start, iterator middle, iterator end, StrictWeakOrdering cmp );</pre>  <p>The partial_sort() function arranges the first N elements of the  range [<em>start</em>,<em>end</em>) in ascending order. N is defined  as the number of elements between <em>start</em> and  <em>middle</em>.</p>  <p>By default, the &lt; operator is used to compare two elements. If  the strict weak ordering comparison function <em>cmp</em> is given,  it is used instead.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="binary_search.html">binary_search</a><br>    <a href="is_sorted.html">is_sorted</a><br>    <a href="nth_element.html">nth_element</a><br>    <a href="partial_sort_copy.html">partial_sort_copy</a><br>    <a href="sort.html">sort</a><br>    <a href="stable_sort.html">stable_sort</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    partial_sort_copy  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  iterator partial_sort_copy( iterator start, iterator end, iterator result_start, iterator result_end );  iterator partial_sort_copy( iterator start, iterator end, iterator result_start, iterator result_end, StrictWeakOrdering cmp );</pre>  <p>The partial_sort_copy() algorithm behaves like <a href=  "partial_sort.html">partial_sort</a>(), except that instead of  partially sorting the range in-place, a copy of the range is created  and the sorting takes place in the copy. The initial range is defined  by [<em>start</em>,<em>end</em>) and the location of the copy is  defined by [<em>result_start</em>,<em>result_end</em>).</p>  <p>partial_sort_copy() returns an iterator to the end of the copied,  partially-sorted range of elements.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="binary_search.html">binary_search</a><br>    <a href="is_sorted.html">is_sorted</a><br>    <a href="partial_sort.html">partial_sort</a><br>    <a href="sort.html">sort</a><br>    <a href="stable_sort.html">stable_sort</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    partial_sum  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;numeric&gt;  iterator partial_sum( iterator start, iterator end, iterator result );  iterator partial_sum( iterator start, iterator end, iterator result, BinOp p );</pre>  <p>The partial_sum() function calculates the partial sum of a range  defined by [<em>start</em>,<em>end</em>), storing the output at  <em>result</em>.</p>  <ul>    <li><em>start</em> is assigned to *<em>result</em>, the sum of    *<em>start</em> and *(<em>start</em> + 1) is assigned to    *(<em>result</em> + 1), etc.</li>  </ul>  <p>partial_sum() runs in <a href="../complexity.html">linear  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="accumulate.html">accumulate</a><br>    <a href="adjacent_difference.html">adjacent_difference</a><br>    <a href="count.html">count</a><br>    <a href="inner_product.html">inner_product</a><br>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    partition  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  iterator partition( iterator start, iterator end, Predicate p );</pre>  <p>The partition() algorithm re-orders the elements in  [<em>start</em>,<em>end</em>) such that the elements for which the  predicate <em>p</em> returns true come before the elements for which  <em>p</em> returns false.</p>  <p>In other words, partition() uses <em>p</em> to divide the elements  into two groups.</p>  <p>The return value of partition() is an iterator to the first  element for which <em>p</em> returns false.</p>  <p>parition() runs in <a href="../complexity.html">linear  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="stable_partition.html">stable_partition</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    pop_heap  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  void pop_heap( iterator start, iterator end );  void pop_heap( iterator start, iterator end, StrictWeakOrdering cmp );</pre>  <p>The pop_heap() function removes the larges element (defined as the  element at the front of the heap) from the given heap.</p>  <p>If the strict weak ordering comparison function object  <em>cmp</em> is given, then it is used instead of the &lt; operator  to compare elements.</p>  <p>pop_heap() runs in <a href="../complexity.html">logarithmic  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="is_heap.html">is_heap</a><br>    <a href="make_heap.html">make_heap</a><br>    <a href="push_heap.html">push_heap</a><br>    <a href="sort_heap.html">sort_heap</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    prev_permutation  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  bool prev_permutation( iterator start, iterator end );  bool prev_permutation( iterator start, iterator end, StrictWeakOrdering cmp );</pre>  <p>The prev_permutation() function attempts to transform the given  range of elements [<em>start</em>,<em>end</em>) into the next  lexicographically smaller permutation of elements. If it succeeds, it  returns true, otherwise, it returns false.</p>  <p>If a strict weak ordering function object <em>cmp</em> is  provided, it is used instead of the &lt; operator when comparing  elements.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="next_permutation.html">next_permutation</a><br>    <a href="random_sample.html">random_sample</a><br>    <a href="random_sample_n.html">random_sample_n</a><br>    <a href="random_shuffle.html">random_shuffle</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    push_heap  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  void push_heap( iterator start, iterator end );  void push_heap( iterator start, iterator end, StrictWeakOrdering cmp );</pre>  <p>The push_heap() function adds an element (defined as the last  element before <em>end</em>) to a heap (defined as the range of  elements between [<em>start</em>,&#39;&#39;end-1).</p>  <p>If the strict weak ordering comparison function object  <em>cmp</em> is given, then it is used instead of the &lt; operator  to compare elements.</p>  <p>push_heap() runs in <a href="../complexity.html">logarithmic  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="is_heap.html">is_heap</a><br>    <a href="make_heap.html">make_heap</a><br>    <a href="pop_heap.html">pop_heap</a><br>    <a href="sort_heap.html">sort_heap</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    random_sample  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  iterator random_sample( iterator start1, iterator end1, iterator start2, iterator end2 );  iterator random_sample( iterator start1, iterator end1, iterator start2, iterator end2, RandomNumberGenerator&amp; rnd );</pre>  <p>The random_sample() algorithm randomly copies elements from  [<em>start1</em>,<em>end1</em>) to [<em>start2</em>,<em>end2</em>).  Elements are chosen with uniform probability and elements from the  input range will appear at most once in the output range.</p>  <p>If a random number generator function object <em>rnd</em> is  supplied, then it will be used instead of an internal random number  generator.</p>  <p>The return value of random_sample() is an iterator to the end of  the output range.</p>  <p>random_sample() runs in <a href="../complexity.html">linear  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="next_permutation.html">next_permutation</a><br>    <a href="prev_permutation.html">prev_permutation</a><br>    <a href="random_sample_n.html">random_sample_n</a><br>    <a href="random_shuffle.html">random_shuffle</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    random_sample_n  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  iterator random_sample_n( iterator start, iterator end, iterator result, size_t N );  iterator random_sample_n( iterator start, iterator end, iterator result, size_t N, RandomNumberGenerator&amp; rnd );</pre>  <p>The random_sample_n() algorithm randomly copies <em>N</em>  elements from [<em>start</em>,<em>end</em>) to <em>result</em>.  Elements are chosen with uniform probability and elements from the  input range will appear at most once in the output range.  <strong>Element order is preserved</strong> from the input range to  the output range.</p>  <p>If a random number generator function object <em>rnd</em> is  supplied, then it will be used instead of an internal random number  generator.</p>  <p>The return value of random_sample_n() is an iterator to the end of  the output range.</p>  <p>random_sample_n() runs in <a href="../complexity.html">linear  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="next_permutation.html">next_permutation</a><br>    <a href="prev_permutation.html">prev_permutation</a><br>    <a href="random_sample.html">random_sample</a><br>    <a href="random_shuffle.html">random_shuffle</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    random_shuffle  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  void random_shuffle( iterator start, iterator end );  void random_shuffle( iterator start, iterator end, RandomNumberGenerator&amp; rnd );</pre>  <p>The random_shuffle() function randomly re-orders the elements in  the range [<em>start</em>,<em>end</em>). If a rand

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -