• <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的博客
            99久久99久久精品国产片果冻| 午夜视频久久久久一区| 久久er99热精品一区二区| 亚洲AV乱码久久精品蜜桃| 无码人妻久久一区二区三区免费丨| 精品久久久无码人妻中文字幕| 精品伊人久久大线蕉色首页| 日韩精品久久久肉伦网站| 久久久久久久综合日本亚洲 | 久久亚洲电影| 久久精品无码一区二区无码| 国内精品久久久久影院网站| 亚洲午夜久久久久妓女影院| 女人香蕉久久**毛片精品| 色婷婷久久久SWAG精品| 久久国产精品一国产精品金尊| 国产精品99精品久久免费| 久久精品国产亚洲5555| 看全色黄大色大片免费久久久| 国内精品伊人久久久影院| 国内精品久久人妻互换| 一级a性色生活片久久无| 久久精品国产亚洲精品2020| 伊人久久一区二区三区无码| 国内精品久久九九国产精品| 久久香综合精品久久伊人| 精品久久久久国产免费| 久久精品国产亚洲欧美| 久久精品天天中文字幕人妻| 久久这里只精品99re66| 四虎久久影院| 久久WWW免费人成—看片| 久久99国产精品久久99| 午夜天堂av天堂久久久| 久久www免费人成精品香蕉| 国产精品永久久久久久久久久| 国产情侣久久久久aⅴ免费| 欧美噜噜久久久XXX| 色欲久久久天天天综合网精品| 中文字幕久久久久人妻| 久久这里只有精品首页|