• <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)

            隨筆檔案

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            剛剛裝上VC8,發(fā)現(xiàn)VC8現(xiàn)在也支持hash_map了,終于可以不用STLPort了(不是不想用,而是在VC里面用太TNND麻煩了)。不過VC8上的hash-map還是有不爽的地方 1。它定義在stdext namespace 中 2。它需要至少specialize兩個(gè)template來添加自定義類。。。不過終究還是算不小的的進(jìn)步啦;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 閱讀(2018) 評(píng)論(1)  編輯 收藏 引用

            FeedBack:
            # re: VC8 的 hash_map 2007-04-05 08:59 
            VC7里面一樣有啊  回復(fù)  更多評(píng)論
              

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


            日韩精品久久久久久| 天天爽天天狠久久久综合麻豆| 国产成人精品久久| 18岁日韩内射颜射午夜久久成人| 亚洲乱码精品久久久久..| 伊人久久大香线蕉影院95| 亚洲国产精品无码久久九九| A狠狠久久蜜臀婷色中文网| 午夜精品久久久久久久无码| 久久久免费精品re6| 亚洲国产成人久久笫一页| 久久综合九色综合精品| 亚洲va久久久噜噜噜久久| 久久受www免费人成_看片中文| 久久精品免费观看| 2022年国产精品久久久久| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区| 一本色道久久88精品综合| 亚洲午夜精品久久久久久app| 久久亚洲欧美日本精品| 久久99国产综合精品| 无码人妻久久一区二区三区| 久久精品国产AV一区二区三区 | 无码日韩人妻精品久久蜜桃| 国产香蕉97碰碰久久人人| 久久线看观看精品香蕉国产| 久久精品国产亚洲AV香蕉| 午夜人妻久久久久久久久| 三上悠亚久久精品| 久久国产色AV免费观看| 日本久久久久亚洲中字幕| 国色天香久久久久久久小说| 中文成人无码精品久久久不卡| 麻豆久久| 久久99久国产麻精品66| 久久精品夜夜夜夜夜久久| 久久噜噜电影你懂的| 久久久久国产日韩精品网站| 久久中文字幕视频、最近更新| 久久久这里有精品| 久久这里只有精品18|