• <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,發現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 閱讀(2011) 評論(1)  編輯 收藏 引用

            FeedBack:
            # re: VC8 的 hash_map 2007-04-05 08:59 
            VC7里面一樣有啊  回復  更多評論
              
            国产A三级久久精品| 香蕉99久久国产综合精品宅男自| 久久久久久精品免费看SSS| 久久人妻无码中文字幕| 亚洲愉拍99热成人精品热久久| 99久久精品国内| 久久久久综合国产欧美一区二区| 色悠久久久久久久综合网| 日本WV一本一道久久香蕉| 狠狠色丁香久久综合婷婷| 亚洲欧美精品一区久久中文字幕| 97精品依人久久久大香线蕉97| 国内精品久久久久影院日本| 欧美日韩精品久久久免费观看| 亚洲精品美女久久久久99| 国产高潮久久免费观看| 亚洲中文久久精品无码| 欧美与黑人午夜性猛交久久久 | 久久婷婷五月综合色奶水99啪| 久久综合久久久| 亚洲欧美成人综合久久久| 久久久久成人精品无码 | 人人狠狠综合久久亚洲婷婷| 午夜精品久久久久久影视riav| 99久久精品费精品国产| 久久精品亚洲精品国产色婷| 2021国产精品久久精品| 久久综合五月丁香久久激情| 99久久夜色精品国产网站| 99精品国产在热久久无毒不卡| 亚洲伊人久久精品影院| 国产精品久久新婚兰兰| 久久影视综合亚洲| 欧美色综合久久久久久| 老司机午夜网站国内精品久久久久久久久| 久久国产色AV免费观看| 久久国产精品成人片免费| 久久超碰97人人做人人爱| 亚洲精品美女久久久久99| 嫩草伊人久久精品少妇AV| 人妻无码αv中文字幕久久琪琪布 人妻无码久久一区二区三区免费 人妻无码中文久久久久专区 |