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

📄 cppset_details.html

📁 ssd5 数据结构的课件
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <meta name="generator" content="HTML Tidy for Linux/x86 (vers 1st October 2002), see www.w3.org">    <title>C++ Sets</title>  </head>  <body bgcolor="#ffffff">    <table width="100%" bgcolor="#eeeeff">      <tr>        <td><a href="index.html">cppreference.com</a> -&gt; <a href="cppset.html">C++ Sets</a> -&gt;        Details</td>      </tr>    </table>    <h1>C++ Sets</h1>    <hr>    <h2><a name="begin">begin</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  <a href="iterators.html">iterator</a> begin();</pre>        </td>      </tr>    </table>    <p>The begin() function returns an <a href="iterators.html">iterator</a> to the first element of the    current set.</p>    <hr>    <h2><a name="clear">clear</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  void clear();</pre>        </td>      </tr>    </table>    <p>The clear() function removes all of the elements from the current set.</p>    <hr>    <h2><a name="count">count</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  size_type count( const key_type &amp;key );</pre>        </td>      </tr>    </table>    <p>The function count() returns the number of occurances of <i>key</i> in the current set.</p>    <hr>    <h2><a name="empty">empty</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  bool empty();</pre>        </td>      </tr>    </table>    <p>The empty() function returns <strong>true</strong> if the current set is empty, and    <strong>false</strong> otherwise.</p>    <hr>    <h2><a name="end">end</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  const_iterator end();</pre>        </td>      </tr>    </table>    <p>The end() function returns an <a href="iterators.html">iterator</a> to the end of the current set.</p>    <hr>    <h2><a name="equal_range">equal_range</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  pair&lt;iterator,iterator&gt; equal_range( const key_type &amp;key );</pre>        </td>      </tr>    </table>    <p>The function equal_range() finds the first and last locations of <i>key</i> in the current set, and    returns iterators to those locations.</p>    <hr>    <h2><a name="erase">erase</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  void erase( <a href="iterators.html">iterator</a> i );  void erase( <a href="iterators.html">iterator</a> start, <a href="iterators.html">iterator</a> end );  size_type erase( const key_type &amp;key );</pre>        </td>      </tr>    </table>    <p>The erase() function either:</p>    <ul>      <li>erases the element at location <i>i</i>,</li>      <li>erases the elements from <i>start</i> to <i>end</i>, or</li>      <li>erases all elements that have a value of <i>key</i> (returning the number of elements erased).</li>    </ul>    <br>    <br>         <hr>    <h2><a name="find">find</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  <a href="iterators.html">iterator</a> find( const key_type &amp;key );</pre>        </td>      </tr>    </table>    <p>The find() function attempts to find an element of the current set that matches <i>key</i>, then    returns an <a href="iterators.html">iterator</a> to that element. If no match is found, an <a href=    "iterators.html">iterator</a> to the end of the set is returned.</p>    <hr>    <h2><a name="get_allocator">get_allocator</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  allocator_type get_allocator();</pre>        </td>      </tr>    </table>    <p>The get_allocator() function returns the allocator for the current set.</p>    <hr>    <h2><a name="insert">insert</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  <a href="iterators.html">iterator</a> insert( <a href="iterators.html">iterator</a> i, const <a href="containers.html">TYPE</a> &amp;val );  void insert( <a href="iterators.html">input_iterator</a> start, <a href="iterators.html">input_iterator</a> end );  pair&lt;iterator,bool&gt; insert( const <a href="containers.html">TYPE</a> &amp;val );</pre>        </td>      </tr>    </table>    <p>The function insert() either:</p>    <ul>      <li>inserts <i>val</i> after the element at <i>i</i>,</li>      <li>inserts a range of elements denoted by <i>start</i> and <i>end</i>, or</li>      <li>inserts <i>val</i> into the current set, returning an <a href="iterators.html">iterator</a> and a      boolean value indicating whether <i>val</i> was successfully inserted.</li>    </ul>    It should be noted that duplicate elements are not inserted into sets. <br>    <br>         <hr>    <h2><a name="lower_bound">lower_bound</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  <a href="iterators.html">iterator</a> lower_bound( const key_type &amp;key );</pre>        </td>      </tr>    </table>    <p>The function lower_bound() returns an <a href="iterators.html">iterator</a> to the first element in    the current set with a key equal to or greater than <i>key</i>.</p>    <hr>    <h2><a name="key_comp">key_comp</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  key_compare key_comp();</pre>        </td>      </tr>    </table>    <p>The function key_comp() returns a function object that compares keys.</p>    <hr>    <h2><a name="max_size">max_size</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  size_type max_size();</pre>        </td>      </tr>    </table>    <p>The max_size() function returns the maximum number of elements that the current set can hold.</p>    <hr>    <h2><a name="rbegin">rbegin</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  <a href="iterators.html">reverse_iterator</a> rbegin();</pre>        </td>      </tr>    </table>    <p>The function rbegin() returns a reverse <a href="iterators.html">iterator</a> to the end of the    current set.</p>    <hr>    <h2><a name="rend">rend</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  <a href="iterators.html">reverse_iterator</a> rend();</pre>        </td>      </tr>    </table>    <p>The rend() function returns a reverse <a href="iterators.html">iterator</a> to the beginning of the    current set.</p>    <hr>    <h2><a name="size">size</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  size_type size();</pre>        </td>      </tr>    </table>    <p>The size() function returns the number of elements in the current set.</p>    <hr>    <h2><a name="swap">swap</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  void swap( set&lt;Key,Comp,Allocator&gt; &amp;object );</pre>        </td>      </tr>    </table>    <p>The function swap() exchanges the elements stored in the current set with those in <i>object</i>.</p>    <hr>    <h2><a name="upper_bound">upper_bound</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  <a href="iterators.html">iterator</a> upper_bound( const key_type &amp;key );</pre>        </td>      </tr>    </table>    <p>The upper_bound() function returns an <a href="iterators.html">iterator</a> to the first element in    the current set with a key greater than <i>key</i>.</p>    <hr>    <h2><a name="value_comp">value_comp</a></h2>    <i>Syntax:</i>     <table bgcolor="#ccccff">      <tr>        <td><pre>  value_compare value_comp();</pre>        </td>      </tr>    </table>    <p>The value_comp() function returns a function object that compares values.</p>  </body></html>

⌨️ 快捷键说明

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