• <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年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

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

            FeedBack:
            # re: VC8 的 hash_map 2007-04-05 08:59 
            VC7里面一樣有啊  回復  更多評論
              
            久久影视综合亚洲| 国产一级持黄大片99久久| 热re99久久6国产精品免费| 亚洲国产欧美国产综合久久| 色播久久人人爽人人爽人人片AV| 国产免费久久久久久无码| 中文精品久久久久人妻| 亚洲午夜久久久久久噜噜噜| 无码精品久久久久久人妻中字| 国产美女久久久| 午夜久久久久久禁播电影| 久久99精品国产麻豆| 国产亚洲精久久久久久无码77777| 久久精品人人做人人妻人人玩| 伊人色综合久久| 97久久综合精品久久久综合| 伊色综合久久之综合久久| 996久久国产精品线观看| 久久亚洲美女精品国产精品| 污污内射久久一区二区欧美日韩| 久久精品aⅴ无码中文字字幕重口| 中文字幕久久精品无码| 国产亚洲成人久久| 四虎国产精品免费久久5151| 久久婷婷五月综合国产尤物app| 亚洲国产另类久久久精品| 亚洲国产成人久久一区WWW| 99久久免费国产精品特黄| 亚洲第一极品精品无码久久 | 热re99久久精品国产99热| 久久久久AV综合网成人 | 久久99国产精品一区二区| 久久精品国产亚洲AV嫖农村妇女| 久久99国产精一区二区三区| 97久久精品人人做人人爽| 久久伊人五月天论坛| 久久精品国产99国产精品导航| 亚洲AV无码1区2区久久| 99久久国语露脸精品国产| 色99久久久久高潮综合影院| 麻豆亚洲AV永久无码精品久久|