• <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 常興龍 閱讀(699) 評論(0)  編輯 收藏 引用
            > hi的博客
            久久综合给合综合久久| 秋霞久久国产精品电影院| 色综合合久久天天给综看| 人人狠狠综合久久亚洲高清| 东方aⅴ免费观看久久av| 久久精品天天中文字幕人妻| 国产精品午夜久久| 伊人久久大香线蕉av不卡| 一本久久a久久精品vr综合| 国产欧美一区二区久久| 久久人人爽人人澡人人高潮AV | 久久国产成人| 欧美激情一区二区久久久| 久久99国产精品一区二区| 青春久久| 26uuu久久五月天| 久久中文字幕精品| 国产精品99久久不卡| 亚洲AV无码久久| 久久大香萑太香蕉av| 亚洲欧美精品伊人久久| 久久男人Av资源网站无码软件| 成人国内精品久久久久影院VR| 久久亚洲私人国产精品vA| 日本久久中文字幕| 狠狠色综合网站久久久久久久| 久久久精品国产sm调教网站 | 亚洲综合日韩久久成人AV| 久久久久国产精品麻豆AR影院| 久久久久亚洲AV无码网站| 久久天天婷婷五月俺也去| 无码人妻少妇久久中文字幕| 伊人色综合久久| 久久国产免费观看精品| 久久精品9988| 中文精品久久久久国产网址| 嫩草影院久久国产精品| 久久香蕉综合色一综合色88| .精品久久久麻豆国产精品| 久久精品一区二区国产| 久久精品国产精品亚洲精品|