• <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年3月>
            25262728123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

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

            FeedBack:
            # re: VC8 的 hash_map 2007-04-05 08:59 
            VC7里面一樣有啊  回復  更多評論
              
            成人资源影音先锋久久资源网| 天天综合久久久网| 一级a性色生活片久久无少妇一级婬片免费放 | 久久久青草青青亚洲国产免观| 久久99热这里只有精品66| 久久久久99这里有精品10| 久久亚洲欧美国产精品| 91精品国产91久久久久福利 | 国产L精品国产亚洲区久久| 久久精品亚洲欧美日韩久久| 狠狠色丁香婷婷久久综合五月 | 久久综合九色综合网站| 狠狠色噜噜狠狠狠狠狠色综合久久| 国产免费福利体检区久久| 婷婷伊人久久大香线蕉AV | 久久久久久亚洲精品不卡 | 国产呻吟久久久久久久92| 久久99久国产麻精品66| 伊人久久大香线焦综合四虎| 久久人人爽人人爽人人爽| 久久高清一级毛片| 91精品国产色综合久久| 久久人人爽人人爽人人片av麻烦| aaa级精品久久久国产片| 中文字幕无码精品亚洲资源网久久| 99精品久久久久久久婷婷| 久久国产精品77777| 久久亚洲精品无码VA大香大香| 人人狠狠综合久久亚洲婷婷| 日韩精品久久无码人妻中文字幕| 久久久久人妻精品一区三寸蜜桃| 久久国产精品-久久精品| 久久精品中文字幕无码绿巨人 | 中文字幕久久亚洲一区| 久久久精品人妻无码专区不卡| 久久亚洲综合色一区二区三区| 无码人妻久久一区二区三区 | 色天使久久综合网天天 | 久久久久免费精品国产| 久久99国产精品一区二区| 久久精品国产亚洲综合色|