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

📄 all.html

📁 从www.CppReference.com打包的C++参考手册
💻 HTML
📖 第 1 页 / 共 3 页
字号:
    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void push_front( const <a href="../containers.html">TYPE</a>&amp; val );</pre>  <p>The push_front() function inserts <em>val</em> at the beginning of  list.</p>  <p>push_front() runs in <a href="../complexity.html">constant  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="assign.html">assign</a><br>    <a href="front.html">front</a><br>    <a href="insert.html">insert</a><br>    <a href="pop_front.html">pop_front</a><br>    <a href="push_back.html">push_back</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    rbegin  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  <a href="../iterators.html">reverse_iterator</a> rbegin();  const_<a href="../iterators.html">reverse_iterator</a> rbegin() const;</pre>  <p>The rbegin() function returns a <a href=  "../iterators.html">reverse_iterator</a> to the end of the current  list.</p>  <p>rbegin() runs in <a href="../complexity.html">constant  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="begin.html">begin</a><br>    <a href="end.html">end</a><br>    <a href="rend.html">rend</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    remove  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void remove( const <a href="../containers.html">TYPE</a> &amp;val );</pre>  <p>The function remove() removes all elements that are equal to val  from the list.</p>  <p>For example, the following code creates a list of the first 10  characters of the alphabet, then uses remove() to remove the letter  &#39;E&#39; from the list:</p>  <pre class="example-code">   // Create a list that has the first 10 letters of the alphabet   list&lt;char&gt; charList;   for( int i=0; i &lt; 10; i++ )     charList.push_front( i + 65 );   // Remove all instances of &#39;E&#39;   charList.remove( &#39;E&#39; );              </pre>  <p>Remove runs in <a href="../complexity.html">linear time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="erase.html">erase</a><br>    <a href="remove_if.html">remove_if</a><br>    <a href="unique.html">unique</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    remove_if  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void remove_if( UnPred pr );</pre>  <p>The remove_if() function removes all elements from the list for  which the unary predicate <em>pr</em> is true.</p>  <p>remove_if() runs in <a href="../complexity.html">linear  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="erase.html">erase</a><br>    <a href="remove.html">remove</a><br>    <a href="unique.html">unique</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    rend  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  <a href="../iterators.html">reverse_iterator</a> rend();  const_<a href="../iterators.html">reverse_iterator</a> rend() const;</pre>  <p>The function rend() returns a <a href=  "../iterators.html">reverse_iterator</a> to the beginning of the  current list.</p>  <p>rend() runs in <a href="../complexity.html">constant time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="begin.html">begin</a><br>    <a href="end.html">end</a><br>    <a href="rbegin.html">rbegin</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    resize  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void resize( <strong>size_type</strong> num, const <a href="../containers.html">TYPE</a>&amp; val = <a href="../containers.html">TYPE</a>() );</pre>  <p>The function resize() changes the size of the list to  <em>size</em>. If <em>val</em> is specified then any newly-created  elements will be initialized to have a value of <em>val</em>.</p>  <p>This function runs in <a href="../complexity.html">linear  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    (C++ Multimaps) <a href=    "../cppmultimap/multimap_constructors.html">Multimap constructors    &amp; destructors</a><br>    (C++ Strings) <a href="../cppstring/capacity.html">capacity</a><br>    <a href="size.html">size</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    reverse  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void reverse();</pre>  <p>The function reverse() reverses the list, and takes <a href=  "../complexity.html">linear time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="sort.html">sort</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    size  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  <strong>size_type</strong> size() const;</pre>  <p>The size() function returns the number of elements in the current  list.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    (C++ Strings) <a href="../cppstring/capacity.html">capacity</a><br>    <a href="empty.html">empty</a><br>    (C++ Strings) <a href="../cppstring/length.html">length</a><br>    <a href="max_size.html">max_size</a><br>    <a href="resize.html">resize</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    sort  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void sort();  void sort( BinPred p );</pre>  <p>The sort() function is used to sort lists into ascending order.  Ordering is done via the &lt; operator, unless <em>p</em> is  specified, in which case it is used to determine if an element is  less than another.</p>  <p>Sorting takes N log N time.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="reverse.html">reverse</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    splice  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void splice( iterator pos, list&amp; lst );  void splice( iterator pos, list&amp; lst, iterator del );  void splice( iterator pos, list&amp; lst, iterator start, iterator end );</pre>  <p>The splice() function inserts <em>lst</em> at location  <em>pos</em>. If specified, the element(s) at <em>del</em> or from  <em>start</em> to <em>end</em> are removed.</p>  <p>splice() simply moves elements from one list to another, and  doesn&#39;t actually do any copying or deleting. Because of this,  splice() runs in <a href="../complexity.html">constant time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="insert.html">insert</a><br>    <a href="merge.html">merge</a><br>    <a href="swap.html">swap</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    swap  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void swap( container&amp; from );</pre>  <p>The swap() function exchanges the elements of the current list  with those of <em>from</em>. This function operates in <a href=  "../complexity.html">constant time</a>.</p>  <p>For example, the following code uses the swap() function to  exchange the values of two strings:</p>  <pre class="example-code">   string first( &quot;This comes first&quot; );   string second( &quot;And this is second&quot; );   first.swap( second );   cout &lt;&lt; first &lt;&lt; endl;   cout &lt;&lt; second &lt;&lt; endl;          </pre>  <p>The above code displays:</p>  <pre class="example-code">   And this is second   This comes first             </pre>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="splice.html">splice</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    unique  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;list&gt;  void unique();  void unique( BinPred pr );</pre>  <p>The function unique() removes all consecutive duplicate elements  from the list. Note that only consecutive duplicates are removed,  which may require that you <a href="sort.html">sort</a>() the list  first.</p>  <p>Equality is tested using the == operator, unless <em>pr</em> is  specified as a replacement. The ordering of the elements in a list  should not change after a call to unique().</p>  <p>unique() runs in <a href="../complexity.html">linear time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="container_operators.html">Container operators</a><br>    <a href="remove.html">remove</a><br>    <a href="remove_if.html">remove_if</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr></body></html>

⌨️ 快捷键说明

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