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

📄 find_if.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_if</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_if.html">find_if</a>  </div>  <div class="name-format">    find_if  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;algorithm&gt;  iterator find_if( iterator start, iterator end, UnPred up );</pre>  <p>The find_if() function searches for the first element between  <em>start</em> and <em>end</em> for which the unary predicate  <em>up</em> returns true.</p>  <p>If such an element is found, an iterator pointing to that element  is returned. Otherwise, an iterator pointing to <em>end</em> is  returned.</p>  <p>For example, the following code uses find_if() and a  &quot;greater-than-zero&quot; unary predicate to the first positive,  non-zero number in a list of numbers:</p>  <pre class="example-code"> int nums[] = { 0, -1, -2, -3, -4, 342, -5 }; int* result; int start = 0; int end = 7;            result = find_if( nums + start, nums + end, bind2nd(greater&lt;int&gt;(), 0)); if( *result == nums[end] ) {   cout &lt;&lt; &quot;Did not find any number greater than zero&quot; &lt;&lt; endl; } else {   cout &lt;&lt; &quot;Found a positive non-zero number: &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="equal.html">equal</a><br>    <a href="find.html">find</a><br>    <a href="find_end.html">find_end</a><br>    <a href="find_first_of.html">find_first_of</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 + -