📄 all.html
字号:
Syntax: </div> <pre class="syntax-box"> #include <list> void push_front( const <a href="../containers.html">TYPE</a>& 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 <list> <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 <list> void remove( const <a href="../containers.html">TYPE</a> &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 'E' from the list:</p> <pre class="example-code"> // Create a list that has the first 10 letters of the alphabet list<char> charList; for( int i=0; i < 10; i++ ) charList.push_front( i + 65 ); // Remove all instances of 'E' charList.remove( 'E' ); </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 <list> 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 <list> <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 <list> void resize( <strong>size_type</strong> num, const <a href="../containers.html">TYPE</a>& 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 & 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 <list> 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 <list> <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 <list> void sort(); void sort( BinPred p );</pre> <p>The sort() function is used to sort lists into ascending order. Ordering is done via the < 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 <list> void splice( iterator pos, list& lst ); void splice( iterator pos, list& lst, iterator del ); void splice( iterator pos, list& 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'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 <list> void swap( container& 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( "This comes first" ); string second( "And this is second" ); first.swap( second ); cout << first << endl; cout << second << 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 <list> 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 + -