• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            Cpper
            C/C++高級工程師 Android高級軟件工程師 IT集成工程師 音頻工程師 熟悉c,c++,java,c#,py,js,asp等多種語言 程序猿
            發一系列關于boost庫的使用文章以備使用
            //! boost庫引導1.minmax 
            #include <list>
            #include 
            <algorithm>
            #include 
            <cstdlib>
            #include 
            <iostream>
            #include 
            <boost/algorithm/minmax.hpp>
            #include 
            <boost/algorithm/minmax_element.hpp>

            using namespace std;
            inline 
            void Print(int i)
            {
                std::cout
            <<i<<std::endl;  
            }

            inline 
            int Rand()
            {
                
            return rand()%10;       
            }

            int main()
            {
                list
            <int> l;
                typedef list
            <int>::const_iterator iterator;
                
            //! 使用給定泛函子生成12個隨機數并推入鏈表 
                generate_n(front_inserter(l),12,Rand);
                std::for_each(l.begin(),l.end(),Print);
                std::cout
            <<"list size is:"<<l.size()<<std::endl;
                
            //! 獲取給定序列的對大最小值,返回為std::pair<..,..> 
                pair<iterator,iterator> result = boost::minmax_element(l.begin(),l.end());
                cout
            <<"the smallest element is:"<<*(result.first)<<endl;
                cout
            <<"the largest element is:"<<*(result.second)<<endl;
                
            //! 獲取第一個最小元素 
                iterator minitr = boost::first_min_element(l.begin(),l.end());
                cout
            <<"first min element is:"<<*minitr<<endl;
                system(
            "PAUSE");
                
            return 1;
            }

             
            //! 后論:似乎沒看到什么強大的功能
            //!ccsdu2004

            posted on 2010-08-09 13:31 ccsdu2009 閱讀(666) 評論(1)  編輯 收藏 引用 所屬分類: boost庫等
            Comments
            • # re: boost之1.minmax
              永遠在一起
              Posted @ 2010-12-15 22:21
              強大之處應該是,平時我們些的算法是要2n次比較,而boost的minmax只需要1.5n次比較  回復  更多評論   
             
            久久久久99精品成人片牛牛影视| 久久精品国产亚洲av高清漫画| 伊人久久综合热线大杳蕉下载| 一级做a爰片久久毛片16| 亚洲嫩草影院久久精品| 久久AⅤ人妻少妇嫩草影院| 亚洲午夜久久久| 久久中文骚妇内射| 精品无码久久久久久久久久| 久久亚洲精品无码aⅴ大香| 久久精品中文騷妇女内射| 一本一道久久精品综合| 久久人人添人人爽添人人片牛牛| 久久不见久久见免费视频7| 精品熟女少妇aⅴ免费久久| 久久天天躁夜夜躁狠狠| 国产三级观看久久| 看久久久久久a级毛片| 一级做a爰片久久毛片看看| 久久99精品国产麻豆| 久久久午夜精品| 亚洲精品高清国产一久久| 久久综合噜噜激激的五月天| 久久精品无码一区二区三区免费| 久久综合狠狠综合久久| 久久人人爽人人爽人人片AV东京热 | 久久频这里精品99香蕉久| 久久免费视频观看| 久久久久久国产精品无码超碰| 久久综合五月丁香久久激情| 国产精品久久成人影院| 亚洲狠狠婷婷综合久久蜜芽| 性做久久久久久久久久久| 久久99精品久久久久久9蜜桃| 青青青伊人色综合久久| 国产精品久久亚洲不卡动漫| 色欲av伊人久久大香线蕉影院| 中文字幕无码av激情不卡久久| 激情五月综合综合久久69| 久久国产热这里只有精品| 激情五月综合综合久久69|