• <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
            <2009年5月>
            262728293012
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            剛剛裝上VC8,發(fā)現(xiàn)VC8現(xiàn)在也支持hash_map了,終于可以不用STLPort了(不是不想用,而是在VC里面用太TNND麻煩了)。不過(guò)VC8上的hash-map還是有不爽的地方 1。它定義在stdext namespace 中 2。它需要至少specialize兩個(gè)template來(lái)添加自定義類。。。不過(guò)終究還是算不小的的進(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 閱讀(2010) 評(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   博問(wèn)   Chat2DB   管理


            国产精品日韩深夜福利久久| 中文字幕久久精品无码| 狠狠色丁香久久婷婷综| 精品久久人人做人人爽综合| 久久天天躁狠狠躁夜夜2020| 99精品国产免费久久久久久下载| 精品久久久久久国产| 99久久777色| 久久久久久久久波多野高潮| 国产∨亚洲V天堂无码久久久 | 久久青青草原精品国产软件| 无码8090精品久久一区| 国产精品久久久久AV福利动漫| 99久久国产亚洲高清观看2024| 久久久久久久波多野结衣高潮 | 中文字幕无码av激情不卡久久| 7777精品久久久大香线蕉| 精品久久久久一区二区三区 | 久久人人爽人人爽人人片AV高清| 精品久久久久久亚洲精品 | 久久久这里有精品| 99久久精品费精品国产| 国产99久久精品一区二区| 一本色道久久综合狠狠躁| 久久久WWW免费人成精品| 国产精品久久久久久影院| 亚洲精品无码久久久影院相关影片| 精品国产热久久久福利| 国产一级持黄大片99久久| 日产精品久久久久久久性色| 亚洲精品无码久久久| 久久精品国产亚洲7777| 精品国产综合区久久久久久| 久久亚洲国产午夜精品理论片| 国产91色综合久久免费分享| 97久久精品人妻人人搡人人玩| 久久久久久久亚洲Av无码| 久久婷婷五月综合国产尤物app| 日本WV一本一道久久香蕉| 久久久久久免费视频| 亚洲精品高清国产一线久久|