• <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次比較  回復  更多評論   
             
            韩国三级大全久久网站| 久久精品亚洲福利| 久久黄视频| 久久五月精品中文字幕| 久久综合噜噜激激的五月天| 99re久久精品国产首页2020| 久久人人爽人人澡人人高潮AV| 久久天天躁狠狠躁夜夜2020一| 久久这里都是精品| 99麻豆久久久国产精品免费| 国内精品久久久久久久久电影网| 免费无码国产欧美久久18| 99久久综合狠狠综合久久止| 香港aa三级久久三级老师2021国产三级精品三级在 | 亚洲精品无码成人片久久| 国产一级做a爰片久久毛片| 亚洲AV伊人久久青青草原| 欧美久久综合性欧美| 热re99久久6国产精品免费| 欧美精品丝袜久久久中文字幕 | 亚洲国产精品无码成人片久久| 成人国内精品久久久久影院VR| 精品国产乱码久久久久久呢 | 久久精品成人欧美大片| 99久久国产综合精品成人影院| 国产偷久久久精品专区| 老司机午夜网站国内精品久久久久久久久 | 久久久久久久99精品免费观看| 精品久久久久久久国产潘金莲 | 新狼窝色AV性久久久久久| 久久久久国产一区二区| 亚洲综合久久综合激情久久| 91精品国产高清久久久久久io | 91精品国产9l久久久久| 久久夜色精品国产噜噜噜亚洲AV| 四虎国产精品成人免费久久| 日产久久强奸免费的看| 亚洲国产精品综合久久一线| 伊人久久亚洲综合影院| 亚洲午夜无码AV毛片久久| 亚洲国产成人久久综合碰|