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

📄 find_end.html

📁 从www.CppReference.com打包的C++参考手册
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>  <meta name="generator" content=  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">  <title>find_end</title>  <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table>  <tr>  <td>  <div class="body-content">  <div class="header-box">    <a href="../index.html">cppreference.com</a> &gt; <a href=    "index.html">C++ Algorithms</a> &gt; <a href=    "find_end.html">find_end</a>  </div>  <div class="name-format">    find_end  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  iterator find_end( iterator start, iterator end, iterator seq_start, iterator seq_end );  iterator find_end( iterator start, iterator end, iterator seq_start, iterator seq_end, BinPred bp );</pre>  <p>The find_end() function searches for the sequence of elements  denoted by <em>seq_start</em> and <em>seq_end</em>. If such a  sequence if found between <em>start</em> and <em>end</em>, an  iterator to the first element of the last found sequence is returned.  If no such sequence is found, an iterator pointing to <em>end</em> is  returned.</p>  <p>If the binary predicate <em>bp</em> is specified, then it is used  to when elements match.</p>  <p>For example, the following code uses find_end() to search for two  different sequences of numbers. The the first chunk of code, the last  occurence of &quot;1 2 3&quot; is found. In the second chunk of code,  the sequence that is being searched for is not found:</p>  <pre class="example-code"> int nums[] = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 }; int* result; int start = 0; int end = 11;           int target1[] = { 1, 2, 3 }; result = find_end( nums + start, nums + end, target1 + 0, target1 + 2 ); if( *result == nums[end] ) {   cout &lt;&lt; &quot;Did not find any subsequence matching { 1, 2, 3 }&quot; &lt;&lt; endl; } else {   cout &lt;&lt; &quot;The last matching subsequence is at: &quot; &lt;&lt; *result &lt;&lt; endl; }               int target2[] = { 3, 2, 3 }; result = find_end( nums + start, nums + end, target2 + 0, target2 + 2 ); if( *result == nums[end] ) {   cout &lt;&lt; &quot;Did not find any subsequence matching { 3, 2, 3 }&quot; &lt;&lt; endl; } else {   cout &lt;&lt; &quot;The last matching subsequence is at: &quot; &lt;&lt; *result &lt;&lt; endl; }              </pre>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="adjacent_find.html">adjacent_find</a><br>    <a href="find.html">find</a><br>    <a href="find_first_of.html">find_first_of</a><br>    <a href="find_if.html">find_if</a><br>    <a href="search_n.html">search_n</a>  </div>  </div>  </td>    </tr>  </table></body></html>

⌨️ 快捷键说明

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