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

📄 all.html

📁 从www.CppReference.com打包的C++参考手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
"../containers.html">key_type</a>&amp; key );</pre>  <p>The find() function returns an iterator to <em>key</em>, or an  iterator to the end of the set if <em>key</em> is not found.</p>  <p>find() runs in <a href="../complexity.html">logarithmic  time</a>.</p>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    insert  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;set&gt;  iterator insert( iterator 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>  <p>The function insert() either:</p>  <ul>    <li>inserts <em>val</em> after the element at <em>pos</em> (where    <em>pos</em> is really just a suggestion as to where <em>val</em>    should go, since sets and maps are ordered), and returns an    iterator to that element.</li>    <li>inserts a range of elements from <em>start</em> to    <em>end</em>.</li>    <li>inserts <em>val</em>, but only if <em>val</em> doesn&#39;t    already exist. The return value is an iterator to the element    inserted, and a boolean describing whether an insertion took    place.</li>  </ul>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    (C++ Maps) <a href="../cppmap/map_operators.html">Map operators</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    key_comp  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;set&gt;  key_compare key_comp() const;</pre>  <p>The function key_comp() returns the function that compares  keys.</p>  <p>key_comp() runs in <a href="../complexity.html">constant  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="value_comp.html">value_comp</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    lower_bound  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;set&gt;  iterator lower_bound( const <a href="../containers.html">key_type</a>&amp; key );</pre>  <p>The lower_bound() function returns an iterator to the first  element which has a value greater than or equal to key.</p>  <p>lower_bound() runs in <a href="../complexity.html">logarithmic  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="upper_bound.html">upper_bound</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    max_size  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;set&gt;  <strong>size_type</strong> max_size() const;</pre>  <p>The max_size() function returns the maximum number of elements  that the set can hold. The max_size() function should not be confused  with the <a href="size.html">size</a>() or (C++ Strings) <a href=  "../cppstring/capacity.html">capacity</a>() functions, which return  the number of elements currently in the set and the the number of  elements that the set will be able to hold before more memory will  have to be allocated, respectively.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="size.html">size</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;set&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  set.</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">    rend  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;set&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 set.</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">    size  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;set&gt;  <strong>size_type</strong> size() const;</pre>  <p>The size() function returns the number of elements in the current  set.</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>    (C++ Strings) <a href="../cppstring/resize.html">resize</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;set&gt;  void swap( container&amp; from );</pre>  <p>The swap() function exchanges the elements of the current set 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">    (C++ Lists) <a href="../cpplist/splice.html">splice</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    upper_bound  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;set&gt;  iterator upper_bound( const <a href="../containers.html">key_type</a>&amp; key );</pre>  <p>The function upper_bound() returns an iterator to the first  element in the set with a key greater than <em>key</em>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="lower_bound.html">lower_bound</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    value_comp  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;set&gt;  value_compare value_comp() const;</pre>  <p>The value_comp() function returns the function that compares  values.</p>  <p>value_comp() runs in <a href="../complexity.html">constant  time</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="key_comp.html">key_comp</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr></body></html>

⌨️ 快捷键说明

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