• <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| 久久99精品久久久久久齐齐 | 久久久久噜噜噜亚洲熟女综合| 久久精品国产只有精品2020| 久久99热国产这有精品| 久久成人18免费网站| 丁香色欲久久久久久综合网| 无码超乳爆乳中文字幕久久| 久久er国产精品免费观看8| 欧美精品乱码99久久蜜桃| 国产亚洲婷婷香蕉久久精品| 久久精品国产72国产精福利| 中文字幕人妻色偷偷久久| 国产69精品久久久久99| 亚洲va中文字幕无码久久| 久久久久九九精品影院| 久久精品国产亚洲AV无码娇色 | 2021精品国产综合久久| 中文字幕无码久久人妻| 九九热久久免费视频| 无码国产69精品久久久久网站| 久久人人超碰精品CAOPOREN| 久久国产福利免费| 99精品国产在热久久无毒不卡 | 久久精品国产WWW456C0M| 国产精品免费看久久久| 久久国产精品成人片免费| 女人高潮久久久叫人喷水| 一级女性全黄久久生活片免费| 国产精品免费久久久久影院| 久久久一本精品99久久精品88| 久久人人添人人爽添人人片牛牛| 一本综合久久国产二区| 久久伊人亚洲AV无码网站| 激情综合色综合久久综合| 国产99久久久国产精品~~牛| www.久久99| 久久国产成人精品国产成人亚洲| 中文字幕成人精品久久不卡| 九九热久久免费视频|