• <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 閱讀(673) 評論(1)  編輯 收藏 引用 所屬分類: boost庫等
            Comments
            • # re: boost之1.minmax
              永遠在一起
              Posted @ 2010-12-15 22:21
              強大之處應該是,平時我們些的算法是要2n次比較,而boost的minmax只需要1.5n次比較  回復  更多評論   
             
            人妻精品久久久久中文字幕69| 99久久精品费精品国产一区二区| AA级片免费看视频久久| 久久国产免费直播| 午夜精品久久久久9999高清| 东方aⅴ免费观看久久av | 久久精品国产色蜜蜜麻豆| 欧美色综合久久久久久| 久久无码人妻一区二区三区| 久久精品国产欧美日韩| 午夜久久久久久禁播电影| 久久se精品一区二区影院 | 国产69精品久久久久777| 久久天天躁狠狠躁夜夜2020老熟妇| 2021国内精品久久久久久影院| 国产99精品久久| 国产精品美女久久福利网站| 韩国无遮挡三级久久| 久久夜色精品国产噜噜麻豆| 欧美久久久久久午夜精品| 97久久久久人妻精品专区| 久久久SS麻豆欧美国产日韩| 久久成人18免费网站| 一级做a爰片久久毛片人呢| 97精品依人久久久大香线蕉97| 久久露脸国产精品| 99久久99久久精品国产片| 国产99久久精品一区二区| 亚洲精品乱码久久久久久自慰| 模特私拍国产精品久久| 久久久久综合国产欧美一区二区| 亚洲国产成人久久精品影视| 国产精品久久久久AV福利动漫| 日日躁夜夜躁狠狠久久AV| 区久久AAA片69亚洲| 一级做a爰片久久毛片免费陪| 狠狠人妻久久久久久综合蜜桃| 国产精品99久久精品| a级成人毛片久久| 久久精品蜜芽亚洲国产AV| 精品久久8x国产免费观看|