• <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>
            為了方便顯示map而自定義的兩個(gè)函數(shù),出現(xiàn)了一個(gè)詭異的問題,感謝jinq????@163.com告之解決方法,但是我對(duì)問題的原因還是不太清楚.

            #include <map>
            #include <string>
            #include <iterator>
            #include <iostream>

            using namespace std;
            namespace std    
            {    
                 //如果不將該函數(shù)放入名字空間std則使用ostream_iterator不能通過編譯
                 //但是可以直接用cout輸出pair

                template<class _Elem,class _Traits,class K,class V>
                basic_ostream<_Elem,_Traits>& operator<<(
                    basic_ostream<_Elem,_Traits>& s
                    ,
                    const pair<K,V>& p
                    )
                {
                    return s<<p.first<<" : "<<p.second;
                }

            }

            template<class _Elem,class _Traits,class K,class V>
            basic_ostream<_Elem,_Traits>&  operator<<(
                basic_ostream<_Elem,_Traits>& s
                ,
                const map<K,V>& m
            )
            {
                copy(m.begin(), m.end(), ostream_iterator<pair<K,V> >(s, "\n"));
                return s;
            }

            int main()
            {
                using namespace std;
                map<string,string> a;
                a["key1"]="value1";
                a["key2"]="value2";
                cout<<a;
                system("pause");
                return 0;
            }
            posted on 2007-05-09 13:10 張沈鵬 閱讀(1142) 評(píng)論(7)  編輯 收藏 引用 所屬分類: C++
            Comments
             
            中文字幕乱码久久午夜| 精品久久久久久中文字幕人妻最新| 狠狠色伊人久久精品综合网 | 久久久久久亚洲精品无码| 国产成人久久精品激情| 很黄很污的网站久久mimi色| 久久精品中文字幕一区| 久久亚洲中文字幕精品一区| 久久精品国产2020| 精品久久久久久无码免费| 久久久久亚洲精品中文字幕| 久久笫一福利免费导航| 亚洲一区二区三区日本久久九| 久久久中文字幕日本| 久久99精品国产99久久6男男| 成人亚洲欧美久久久久| 精品免费久久久久久久| 久久久网中文字幕| 国产精久久一区二区三区| 久久精品国产91久久麻豆自制| 大香伊人久久精品一区二区| 成人免费网站久久久| 久久水蜜桃亚洲av无码精品麻豆| 狠狠色综合久久久久尤物| 丁香久久婷婷国产午夜视频| 久久免费精品视频| 久久99国产一区二区三区| 久久久久久无码国产精品中文字幕 | 久久亚洲AV成人无码| 久久综合亚洲色一区二区三区| 久久婷婷五月综合色奶水99啪| 精品久久人人做人人爽综合| 色8激情欧美成人久久综合电| 国内精品伊人久久久久妇| 亚洲精品乱码久久久久久久久久久久| 久久人与动人物a级毛片| 69久久夜色精品国产69| 久久久久无码精品国产app| 无码精品久久久天天影视| 久久国产成人亚洲精品影院 | 亚洲人成伊人成综合网久久久|