• <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
            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿(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 閱讀(2009) 評論(1)  編輯 收藏 引用

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

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


            欧美精品一区二区精品久久| 久久久久99精品成人片试看 | 中文字幕乱码人妻无码久久| 亚洲&#228;v永久无码精品天堂久久 | 久久99精品国产99久久6男男| 国产精品久久影院| 久久亚洲视频| 久久国产亚洲精品无码| 91久久福利国产成人精品| 国产欧美久久久精品| 久久久精品久久久久久| 色欲综合久久躁天天躁蜜桃| 99久久99这里只有免费的精品| 欧美日韩成人精品久久久免费看| 奇米影视7777久久精品人人爽| 国产精品久久一区二区三区 | 久久精品夜色噜噜亚洲A∨| 漂亮人妻被黑人久久精品| 久久久久亚洲AV无码专区桃色| 亚洲色大成网站WWW久久九九| 精品一久久香蕉国产线看播放| 午夜精品久久久久久久| 天天综合久久一二三区| 一本大道久久a久久精品综合 | 久久久噜噜噜久久中文字幕色伊伊| 久久精品国产亚洲一区二区| 亚洲AV日韩精品久久久久久久| 久久久久久无码国产精品中文字幕 | 欧美亚洲色综久久精品国产| 精品免费久久久久国产一区| 精品久久久久久综合日本| 久久亚洲私人国产精品| 精品伊人久久大线蕉色首页| 无码8090精品久久一区| 人妻中文久久久久| 久久精品国产亚洲av瑜伽| 91久久精品国产成人久久| 精品久久一区二区三区| 狠狠色丁香久久综合婷婷| 久久综合中文字幕| 久久香蕉国产线看观看99|