• <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年4月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            剛剛裝上VC8,發(fā)現(xiàn)VC8現(xiàn)在也支持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 閱讀(2029) 評論(1)  編輯 收藏 引用

            FeedBack:
            # re: VC8 的 hash_map 2007-04-05 08:59 
            VC7里面一樣有啊  回復  更多評論
              
            思思久久99热免费精品6| 亚洲人成网亚洲欧洲无码久久| 久久久国产精品网站| 国产精品美女久久久久av爽| 午夜视频久久久久一区 | 久久久久久久波多野结衣高潮| 久久婷婷色综合一区二区| 久久精品草草草| 一本色综合网久久| 欧美精品丝袜久久久中文字幕 | 97久久国产亚洲精品超碰热| 久久国产三级无码一区二区| 国内精品久久久久影院薰衣草| 国产精品激情综合久久| 色欲av伊人久久大香线蕉影院| 久久久久一级精品亚洲国产成人综合AV区 | 亚洲国产精品人久久| 无码国产69精品久久久久网站| 久久93精品国产91久久综合 | 久久综合精品国产一区二区三区| 精品久久久久久综合日本| 国产69精品久久久久9999APGF| 久久中文字幕视频、最近更新| 亚洲综合久久综合激情久久| 国内精品久久久久影院一蜜桃| 精品国产乱码久久久久久人妻 | 2020久久精品国产免费| 人妻无码αv中文字幕久久琪琪布 人妻无码久久一区二区三区免费 人妻无码中文久久久久专区 | 日本强好片久久久久久AAA| 无码人妻久久一区二区三区蜜桃| 久久男人中文字幕资源站| 久久免费观看视频| 女同久久| 亚洲一级Av无码毛片久久精品| 欧美久久综合九色综合| 久久精品国产只有精品66| 久久久噜噜噜久久中文字幕色伊伊| 狠狠人妻久久久久久综合蜜桃| 久久久久国产精品麻豆AR影院| 久久午夜福利电影| 国产99久久久国产精品小说|