• <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>
            隨筆 - 42  文章 - 3  trackbacks - 0
            <2012年7月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(2)

            隨筆檔案

            文章檔案

            網(wǎng)頁(yè)收藏

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            Chapter 4
            Some people find the “90/10” rule helpful: 90 percent of the running time of most programs is spent in only
            10 percent of the code (Hennessy and Patterson, 2002)

            Use a vector instead of an array whenever possible.
            Vectors provide fast (constant time) element insertion and deletion at the end of the vector, but slow
            (linear time) insertion and deletion anywhere else. Insertion and deletion are slow because the operation
            must move all the elements “down” or “up” by one to make room for the new element or to fill the
            space left by the deleted element. Like arrays, vectors provide fast (constant time) access to any of their
            elements.
            You should use a vector in your programs when you need fast access to the elements, but do not plan to
            add or remove elements often. A good rule of thumb is to use a vector whenever you would have used
            an array.

            The name deque is an abbreviation for a double-ended queue. A deque is partway between a vector and a
            list, but closer to a vector. Like a vector, it provides quick (constant time) element access. Like a list, it
            provides fast (amortized constant time) insertion and deletion at both ends of the sequence. However,
            unlike a list, it provides slow (linear time) insertion and deletion in the middle of the sequence.
            You should use a deque instead of a vector when you need to insert or remove elements from either end
            of the sequence but still need fast access time to all elements. However, this requirement does not apply
            to many programming problems; in most cases a vector or queue should suffice.


            A set in STL is a collection of elements. Although the mathematical definition of a set implies an
            unordered collection, the STL set stores the elements in an ordered fashion so that it can provide reasonably
            fast lookup, insertion, and deletion.
            Use a set instead of a vector or list if you want equal performance for insertion, deletion,and lookup.
            Note that a set does not allow duplication of elements. That is, each element in the set must be unique. If
            you want to store duplicate elements, you must use a multiset.


            Chapter8
            Initializer lists allow initialization of data members at the time of their creation.
            An initializer list allows you to provide initial values for data members as they are created, which is more efficient than assigning values to them later.
            However, several data types must be initialized in an initializer list. The following table summarizes them:a、 const data members; b、Reference data members C、Object data members or Superclasses without default constructors
            Initializer lists initialize data members in their declared order in the class definition,not their order in the list.

            Chapter9
            Pass objects by const reference instead of by value.
            The default semantics for passing arguments to functions in C++ is pass-by-value. That means that the function or method receives a copy of the variable, not the variable itself. Thus, whenever you pass an object to a function or method the compiler calls the copy constructor of the new object to initialize it. The copy constructor is also called whenever you return an object from a function or method.
            posted on 2012-07-09 19:41 鷹擊長(zhǎng)空 閱讀(423) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            久久精品成人免费网站| 97久久超碰成人精品网站| 国产成人香蕉久久久久| 精品无码人妻久久久久久| 欧美日韩中文字幕久久久不卡| 噜噜噜色噜噜噜久久| 久久久久亚洲Av无码专| 精品综合久久久久久88小说 | 国产高清国内精品福利99久久| 国产精品VIDEOSSEX久久发布| 亚洲一区精品伊人久久伊人| 国内精品久久久人妻中文字幕| 久久九九免费高清视频| 久久精品午夜一区二区福利| 久久99精品久久久久久水蜜桃| 国内精品久久久久影院薰衣草| 无码人妻精品一区二区三区久久 | 久久影视综合亚洲| 99久久无色码中文字幕| 久久亚洲中文字幕精品一区| 国产成人精品久久综合| 久久精品无码专区免费青青| 99久久做夜夜爱天天做精品| 亚洲欧美日韩精品久久| 91久久婷婷国产综合精品青草| 亚洲欧美日韩久久精品| 国产精品亚洲美女久久久| 国产亚洲欧美精品久久久| 欧美熟妇另类久久久久久不卡| 婷婷久久精品国产| 蜜桃麻豆www久久国产精品| 国产成人久久777777| 色综合久久综合网观看| 好属妞这里只有精品久久| 蜜臀久久99精品久久久久久小说 | 久久99精品久久久久久野外| 国产一区二区三精品久久久无广告| 精品久久一区二区三区| 久久99精品综合国产首页| 久久香蕉综合色一综合色88| 99久久亚洲综合精品网站|