• <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>
            隨筆 - 6  文章 - 8  trackbacks - 0
            <2007年3月>
            25262728123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            剛剛裝上VC8,發現VC8現在也支持hash_map了,終于可以不用STLPort了(不是不想用,而是在VC里面用太TNND麻煩了)。不過VC8上的hash-map還是有不爽的地方 1。它定義在stdext namespace 中 2。它需要至少specialize兩個template來添加自定義類。。。不過終究還是算不小的的進步啦;D =====================================


            ============ VC2005 ================
            // test.cpp : Defines the entry point for the console application.
            //

            #include "stdafx.h"
            #include
            #include
            #include

            struct Key{
              int i;
            };


            namespace std {
              template <> struct less<::Key>
               : public binary_function<::Key, ::Key, bool>
              {
                bool operator()(const ::Key& _Left, const ::Key& _Right) const
                { // apply operator< to operands
                  return (_Left.i < _Right.i);
                }
              };
            }

            namespace stdext {
              template <> size_t hash_value(const Key &key){
                return hash_value(key.i);
              }
            }

            int _tmain(int argc, _TCHAR* argv[])
            {
              stdext::hash_map testmap; 
              Key k;
              k.i = 1;
              testmap[k] = std::string("hello, world");
              testmap[k] = std::string("hello, again");

              std::cout << "size of map: " << testmap.size() << std::endl;
              return 0;
            }

            ============GCC + STLPort ===========
            struct Key {
              ...
            };


            namespace std {
              template <> struct hash {
                size_t operator()(const Key &key) const {
                    ...
                };
              }
            }


            int main()
            {
              ...
            }

            posted on 2007-04-03 14:01 Neal 閱讀(2015) 評論(1)  編輯 收藏 引用

            FeedBack:
            # re: VC8 的 hash_map 2007-04-05 08:59 
            VC7里面一樣有啊  回復  更多評論
              
            久久99国产精品99久久| A狠狠久久蜜臀婷色中文网| 伊人久久大香线蕉精品| 青青青伊人色综合久久| 亚洲第一永久AV网站久久精品男人的天堂AV| 亚洲人成精品久久久久| 老色鬼久久亚洲AV综合| 99久久精品免费观看国产| 久久人人爽人人爽人人片AV高清 | 伊人久久综合成人网| 亚洲中文字幕久久精品无码APP| 色成年激情久久综合| 久久久久久久久波多野高潮| 久久久久久a亚洲欧洲aⅴ| 久久久一本精品99久久精品88| 99国产欧美精品久久久蜜芽| 国产免费久久精品99re丫y| 国产精品久久久久久影院| 模特私拍国产精品久久| 国产精品一区二区久久精品无码| 日韩人妻无码一区二区三区久久 | 久久99精品久久久久久| 亚洲国产精品无码久久九九| 国内精品久久国产大陆| 一本一本久久A久久综合精品 | 亚洲人成伊人成综合网久久久| 人妻丰满?V无码久久不卡| 国产高清国内精品福利99久久| 97热久久免费频精品99| 亚洲精品高清国产一线久久| 亚洲国产成人久久综合区| 久久www免费人成精品香蕉| 爱做久久久久久| 99热都是精品久久久久久| 99久久成人国产精品免费| 99久久久精品免费观看国产| 精品综合久久久久久98| 久久www免费人成看片| 久久国产精品99国产精| 久久精品国产影库免费看| 91精品免费久久久久久久久|