{"id":451,"date":"2011-07-28T12:12:11","date_gmt":"2011-07-28T04:12:11","guid":{"rendered":"http:\/\/www.myvoipapp.com\/blogs\/yxh\/?p=451"},"modified":"2019-02-12T20:11:53","modified_gmt":"2019-02-12T12:11:53","slug":"%e6%a0%87%e5%87%86cc%e4%b8%ad%e7%9a%84map","status":"publish","type":"post","link":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2011\/07\/28\/%e6%a0%87%e5%87%86cc%e4%b8%ad%e7%9a%84map\/","title":{"rendered":"\u6807\u51c6C\/C++\u4e2d\u7684map"},"content":{"rendered":"<p>\u603b\u4f53\u6765\u8bf4\uff0cmap\u8bbe\u8ba1\u5f97\u5f88\u4e0d\u9519\uff0c\u5f88\u65b9\u4fbf\u4f7f\u7528\uff0c\u4f46\u662f\u5176\u4e2d\u6709\u4e9b\u64cd\u4f5c\uff0c\u8ba9\u4eba\u89c9\u5f97\u5341\u5206\u9e21\u808b\uff0c\u4e0d\u5410\u4e0d\u5feb\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5bf9\u4e8e\u6700\u7b80\u5355\u7684\u67e5\u8be2\u64cd\u4f5c\uff0cmap\u5728\u67e5\u8be2\u4e0d\u5230\u7ed3\u679c\u7684\u60c5\u51b5\u4e0b\uff0c\u5c45\u7136\u76f4\u63a5\u63d2\u5165\u4e00\u4e2a\u9ed8\u8ba4\u503c\u3002\u8fd9\u79cd\u505a\u6cd5\u5341\u5206\u591a\u4f59\uff0c\u800c\u4e14\u5371\u9669\uff1a<\/p>\n<p>\uff081\uff09\u63a5\u53e3\u4e0d\u660e\u786e\u3002\u67e5\u8be2\u5c31\u662f\u67e5\u8be2\uff0c\u63d2\u5165\u5c31\u662f\u63d2\u5165\u3002\u73b0\u5728\u5c45\u7136\u5728\u67e5\u8be2\u63a5\u53e3\u4e2d\uff0c\u5185\u542b\u4e00\u4e2a\u63d2\u5165\u64cd\u4f5c\uff0c\u63a5\u53e3\u8bbe\u8ba1\u7684\u539f\u5b50\u6027\u4e0d\u597d\uff0c\u4e0d\u591f\u7b80\u5355\uff0c\u903c\u8feb\u4f7f\u7528\u8005\u53bb\u4f5c\u591a\u4f59\u7684\u601d\u8003\u3002<\/p>\n<p>\uff082\uff09\u7f3a\u7701\u503c\u65e0\u6cd5\u4fdd\u8bc1\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u6574\u6570\u503c\uff0c\u8be5\u63a5\u53e3\u8ba4\u4e3a0\u662f\u7f3a\u7701\u503c\u3002\u800c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u672a\u5fc5\u90fd\u4f1a\u5c060\u4f5c\u4e3a\u7f3a\u7701\u503c\u3002\u5728\u5e94\u7528\u7a0b\u5e8f\u5185\u57cb\u4e0b\u4e86\u5730\u96f7\uff0c\u641e\u4e71\u751a\u81f3\u6467\u6bc1\u7a0b\u5e8f\u3002<\/p>\n<p>\uff083\uff09\u9891\u7e41\u67e5\u8be2\u4e0d\u5b58\u5728\u7684\u8bb0\u5f55\uff0c\u4f1a\u5bfc\u81f4\u5185\u5b58\u4e0d\u65ad\u589e\u52a0\u3002\u8fd9\u5bf9\u4e8eserver\u7c7b\u7a0b\u5e8f\u6765\u8bf4\uff0c\u7b80\u76f4\u8981\u547d\u3002<\/p>\n<p>\u5373\u4f7f\u662f\u5982\u6b64\u7b80\u5355\u7684\u3001\u6807\u51c6\u7684\u6570\u636e\u7ed3\u6784\u64cd\u4f5c\uff0c\u90fd\u53ef\u80fd\u5f15\u6765\u5982\u6b64\u4f17\u591a\u7684\u95ee\u9898\u3002\u5bf9\u4e8e\u5e38\u7528\u7684\u8fd9\u4e9b\u7ed3\u6784\uff0c\u5982\u679c\u4e0d\u662f\u7279\u522b\u5f3a\u8c03\u6548\u7387\u6216\u8005\u901a\u7528\u6027\uff0c\u5b9e\u5728\u662f\u6709\u5fc5\u8981\u5b9a\u4e49\u81ea\u5df1\u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u5c24\u5176\u5bf9\u4e8eserver\u7aef\u5f00\u53d1\u800c\u8a00\uff0c\u4f7f\u7528\u6807\u51c6C++\u5e93\u6216\u8005\u7b2c\u4e09\u65b9\u5e93\u90fd\u5e94\u5f53\u975e\u5e38\u614e\u91cd\u3002<\/p>\n<p>\u6bd4\u8f83\u800c\u8a00\uff0cQT\u4e2d\u7684QHash\/QMultiHash\u8bbe\u8ba1\u5f97\u66f4\u4e3a\u7cbe\u826f\u4e00\u4e9b\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u6d4b\u8bd5\u4ee3\u7801\uff1a<\/p>\n<pre>#include &lt;iostream&gt;\r\n#include &lt;map&gt;\r\n#include &lt;string&gt;\r\n\r\nusing namespace std;\r\n\r\nvoid test()\r\n{\r\n    map&lt;string,int&gt; demo1;\r\n    cout&lt;&lt;\"map size=\"&lt;&lt;demo1.size()&lt;&lt;endl;\r\n    int j=demo1[\"1234\"];\r\n    cout&lt;&lt;\"map size=\"&lt;&lt;demo1.size()&lt;&lt;endl;\r\n}\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    test();\r\n    return 0;\r\n}<\/pre>\n<p>\u6d4b\u8bd5\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<p><!--StartFragment-->map size=0<\/p>\n<p>map size=1<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u603b\u4f53\u6765\u8bf4\uff0cmap\u8bbe\u8ba1\u5f97\u5f88\u4e0d\u9519\uff0c\u5f88\u65b9\u4fbf\u4f7f\u7528\uff0c\u4f46\u662f\u5176\u4e2d\u6709\u4e9b\u64cd\u4f5c\uff0c\u8ba9\u4eba\u89c9\u5f97\u5341\u5206\u9e21\u808b\uff0c\u4e0d\u5410\u4e0d\u5feb\u3002 \u4f8b\u5982\uff0c\u5bf9\u4e8e\u6700\u7b80\u5355\u7684\u67e5\u8be2\u64cd\u4f5c\uff0cmap\u5728\u67e5\u8be2\u4e0d\u5230\u7ed3\u679c\u7684\u60c5\u51b5\u4e0b\uff0c\u5c45\u7136\u76f4\u63a5\u63d2\u5165&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2011\/07\/28\/%e6%a0%87%e5%87%86cc%e4%b8%ad%e7%9a%84map\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[170,40],"class_list":["post-451","post","type-post","status-publish","format-standard","hentry","category-6","tag-hash","tag-map"],"_links":{"self":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/comments?post=451"}],"version-history":[{"count":1,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/451\/revisions"}],"predecessor-version":[{"id":452,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/451\/revisions\/452"}],"wp:attachment":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/media?parent=451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/categories?post=451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/tags?post=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}