<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] # 簡介 STL內建了一些函數對象。分為:算數類函數對象,關系運算類函數對象,邏輯運算類仿函數。 這些仿函數所產生的對象,用法和一般函數完全相同,當然我們還可以產生無名的臨時對象來履行函數功能。使用內建函數對象,需要引入頭文件 `#include<functional>` # 內建對象 * 6個算數類函數對象,除了negate是一元運算,其他都是二元運算。 ~~~ template<classT>T plus<T>//加法仿函數 template<class T> T minus<T>//減法仿函數 template<class T> T multiplies<T>//乘法仿函數 template<class T> T divides<T>//除法仿函數 template<class T> T modulus<T>//取模仿函數 template<class T> T negate<T>//取反仿函數 ~~~ * 6個關系運算類函數對象,每一種都是二元運算。 ~~~ template<class T>bool equal_to<T>//等于 template<class T>bool not_equal_to<T>//不等于 template<class T>bool greater<T>//大于 template<class T>bool greater_equal<T>//大于等于 template<class T>bool less<T>//小于 template<class T>bool less_equal<T>//小于等于 ~~~ * 邏輯運算類運算函數,not為一元運算,其余為二元運算。 ~~~ template<class T>bool logical_and<T>//邏輯與 template<class T>bool logical_or<T>//邏輯或 template<class T>bool logical_not<T>//邏輯非 ~~~ # 例子 ~~~ equal_to<int> MyEqual; plus<int> MyPlus; if (MyEqual(10, 20)) { cout << "相等" << endl; } else { cout << "不相等" << endl; } ~~~ ~~~ vector<int> v; srand((unsignedint)time(NULL)); for(int i =0; i <10; i++){ v.push_back(rand()%100); } for(vector<int>::iterator it = v.begin(); it != v.end(); it++){ cout <<*it <<" "; } cout << endl; sort(v.begin(),v.end(),greater<int>()); for(vector<int>::iterator it = v.begin(); it != v.end(); it++){ cout <<*it <<" "; } cout << endl; ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看