• <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>

            C++研究

            C++細節深度探索及軟件工程

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              37 隨筆 :: 0 文章 :: 74 評論 :: 0 Trackbacks

            In STL , there are many method can traverse the vector object , but the most efficency one ,I think , it's 'for_each' function. And it can be used very near the real life language , what you need do is only to define a function express how you want to act  while it's traversing.

            E.G

            /********************************************************************
             created: 2007/04/19
             created: 19:4:2007   2:04
             filename:  C:\testvc6\TestStll\TestStll.cpp
             file path: C:\testvc6\TestStll
             file base: TestStll
             file ext: cpp
             author:  Chang xinglong(King.C)
             
             purpose: How to traverse a Vector ?
            *********************************************************************/

             

            You can define a travers Function which simply couput the node data , it was defined  like this :

            void Traverse(int t)
            {
                cout
            <<t<<endl;
            }
            ;

            Then Create a integer vector , and use the for each to travers it ,here the code goes like this:
                vector <int> colt;
                
            for (int i=0; i<=10;i++)
                
            {
                    colt.push_back(i);
                }

                for_each(colt.begin(),colt.end(),Traverse);
                cout
            <<endl;


            Very easy and effiency , try to use it in the program instead of the following code:
            for (int i=0;i<max;i++)
            {
               
            int v =(int) aVector[i];
               traverse(v);
            }
            posted on 2007-04-19 02:18 常興龍 閱讀(698) 評論(0)  編輯 收藏 引用
            > hi的博客
            亚洲AV日韩精品久久久久| 久久九九有精品国产23百花影院| 久久影院久久香蕉国产线看观看| 亚洲伊人久久综合影院| 久久亚洲日韩看片无码| 精品亚洲综合久久中文字幕| 久久久91人妻无码精品蜜桃HD| 久久99九九国产免费看小说| 狠狠色丁香久久婷婷综合五月| 精品欧美一区二区三区久久久| 亚洲AV无一区二区三区久久| 久久亚洲高清观看| 久久99精品国产麻豆宅宅| 中文字幕一区二区三区久久网站| 一本色道久久88综合日韩精品 | 久久精品www人人爽人人| 国产精品日韩深夜福利久久| 日本久久久久亚洲中字幕| 久久精品夜色噜噜亚洲A∨| 2021少妇久久久久久久久久| 色综合久久天天综线观看| 7777久久亚洲中文字幕| 久久综合亚洲欧美成人| 亚洲第一永久AV网站久久精品男人的天堂AV| 久久人人爽爽爽人久久久| 一个色综合久久| 久久精品桃花综合| 久久高清一级毛片| 久久男人AV资源网站| 久久久精品午夜免费不卡| 国产精品一久久香蕉产线看 | 无码人妻久久一区二区三区| 亚洲国产一成久久精品国产成人综合 | 久久久久亚洲AV无码网站| 精品国产99久久久久久麻豆| 香蕉aa三级久久毛片 | 欧美一区二区三区久久综合| 亚洲AV无码久久精品狠狠爱浪潮| 一本色道久久综合狠狠躁| 日韩精品久久久肉伦网站| 天天爽天天狠久久久综合麻豆|