{"id":44929,"date":"2025-06-21T06:06:28","date_gmt":"2025-06-20T22:06:28","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/44929.html"},"modified":"2025-06-21T06:06:28","modified_gmt":"2025-06-20T22:06:28","slug":"c%e4%b8%ad%e5%a6%82%e4%bd%95%e9%81%8d%e5%8e%86map%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/44929.html","title":{"rendered":"C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\n<ul>\n<li>\n<ul>\n<li>1. \u4f7f\u7528\u8303\u56f4for\u5faa\u73af&#xff08;C&#043;&#043;11\u53ca\u4ee5\u4e0a&#xff09;<\/li>\n<li>2. \u4f7f\u7528\u8fed\u4ee3\u5668<\/li>\n<li>3. \u4f7f\u7528\u53cd\u5411\u8fed\u4ee3\u5668<\/li>\n<li>\u6ce8\u610f\u4e8b\u9879<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p> \u5728C&#043;&#043;\u4e2d&#xff0c;<br \/>\nstd::map \u662f\u4e00\u79cd\u5173\u8054\u5bb9\u5668&#xff0c;\u5b83\u5b58\u50a8\u7684\u662f\u952e\u503c\u5bf9&#xff08;key-value pairs&#xff09;&#xff0c;\u5e76\u4e14\u6309\u952e\u7684\u987a\u5e8f\u8fdb\u884c\u6392\u5e8f\u3002\u904d\u5386<br \/>\nstd::map \u6709\u591a\u79cd\u65b9\u5f0f&#xff0c;\u4ee5\u4e0b\u662f\u51e0\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5&#xff1a; <\/p>\n<h4>1. \u4f7f\u7528\u8303\u56f4for\u5faa\u73af&#xff08;C&#043;&#043;11\u53ca\u4ee5\u4e0a&#xff09;<\/h4>\n<p>\u8303\u56f4for\u5faa\u73af&#xff08;range-based for loop&#xff09;\u662fC&#043;&#043;11\u5f15\u5165\u7684\u4e00\u79cd\u7b80\u6d01\u7684\u904d\u5386\u5bb9\u5668\u7684\u65b9\u5f0f\u3002<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;iostream&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;map&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>map<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">int<\/span><span class=\"token punctuation\">,<\/span> std<span class=\"token double-colon punctuation\">::<\/span>string<span class=\"token operator\">&gt;<\/span> myMap <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;one&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;two&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;three&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">const<\/span> <span class=\"token keyword\">auto<\/span><span class=\"token operator\">&amp;<\/span> pair <span class=\"token operator\">:<\/span> myMap<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        std<span class=\"token double-colon punctuation\">::<\/span>cout <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;Key: &#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> pair<span class=\"token punctuation\">.<\/span>first <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;, Value: &#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> pair<span class=\"token punctuation\">.<\/span>second <span class=\"token operator\">&lt;&lt;<\/span> std<span class=\"token double-colon punctuation\">::<\/span>endl<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d&#xff0c;pair \u662f\u4e00\u4e2a\u5305\u542b\u952e\u548c\u503c\u7684 std::pair \u5bf9\u8c61&#xff0c;pair.first \u662f\u952e&#xff0c;pair.second \u662f\u503c\u3002<\/p>\n<h4>2. \u4f7f\u7528\u8fed\u4ee3\u5668<\/h4>\n<p>\u8fed\u4ee3\u5668\u662f\u904d\u5386STL\u5bb9\u5668\u7684\u4f20\u7edf\u65b9\u5f0f\u3002<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;iostream&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;map&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>map<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">int<\/span><span class=\"token punctuation\">,<\/span> std<span class=\"token double-colon punctuation\">::<\/span>string<span class=\"token operator\">&gt;<\/span> myMap <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;one&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;two&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;three&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">auto<\/span> it <span class=\"token operator\">&#061;<\/span> myMap<span class=\"token punctuation\">.<\/span><span class=\"token function\">begin<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> it <span class=\"token operator\">!&#061;<\/span> myMap<span class=\"token punctuation\">.<\/span><span class=\"token function\">end<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token operator\">&#043;&#043;<\/span>it<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        std<span class=\"token double-colon punctuation\">::<\/span>cout <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;Key: &#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> it<span class=\"token operator\">-&gt;<\/span>first <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;, Value: &#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> it<span class=\"token operator\">-&gt;<\/span>second <span class=\"token operator\">&lt;&lt;<\/span> std<span class=\"token double-colon punctuation\">::<\/span>endl<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d&#xff0c;it \u662f\u4e00\u4e2a\u8fed\u4ee3\u5668&#xff0c;\u6307\u5411 std::map \u4e2d\u7684\u5143\u7d20\u3002it-&gt;first \u548c it-&gt;second \u5206\u522b\u8bbf\u95ee\u952e\u548c\u503c\u3002<\/p>\n<h4>3. \u4f7f\u7528\u53cd\u5411\u8fed\u4ee3\u5668<\/h4>\n<p>\u5982\u679c\u4f60\u60f3\u8981\u4ece std::map \u7684\u672b\u5c3e\u5f00\u59cb\u904d\u5386&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u53cd\u5411\u8fed\u4ee3\u5668\u3002<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;iostream&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;map&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>map<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">int<\/span><span class=\"token punctuation\">,<\/span> std<span class=\"token double-colon punctuation\">::<\/span>string<span class=\"token operator\">&gt;<\/span> myMap <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;one&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;two&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;three&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">auto<\/span> it <span class=\"token operator\">&#061;<\/span> myMap<span class=\"token punctuation\">.<\/span><span class=\"token function\">rbegin<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> it <span class=\"token operator\">!&#061;<\/span> myMap<span class=\"token punctuation\">.<\/span><span class=\"token function\">rend<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token operator\">&#043;&#043;<\/span>it<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        std<span class=\"token double-colon punctuation\">::<\/span>cout <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;Key: &#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> it<span class=\"token operator\">-&gt;<\/span>first <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;, Value: &#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> it<span class=\"token operator\">-&gt;<\/span>second <span class=\"token operator\">&lt;&lt;<\/span> std<span class=\"token double-colon punctuation\">::<\/span>endl<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u53cd\u5411\u8fed\u4ee3\u5668\u7684\u5de5\u4f5c\u65b9\u5f0f\u4e0e\u6b63\u5411\u8fed\u4ee3\u5668\u7c7b\u4f3c&#xff0c;\u4f46\u5b83\u4eec\u4ece\u5bb9\u5668\u7684\u672b\u5c3e\u5f00\u59cb&#xff0c;\u5411\u524d\u79fb\u52a8\u3002<\/p>\n<h4>\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>\u5728\u904d\u5386\u8fc7\u7a0b\u4e2d&#xff0c;\u4e0d\u8981\u4fee\u6539\u5bb9\u5668\u7684\u5927\u5c0f&#xff08;\u4f8b\u5982&#xff0c;\u4e0d\u8981\u63d2\u5165\u6216\u5220\u9664\u5143\u7d20&#xff09;&#xff0c;\u56e0\u4e3a\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8fed\u4ee3\u5668\u5931\u6548\u3002<\/li>\n<li>\u5982\u679c\u4f60\u53ea\u9700\u8981\u904d\u5386\u952e\u6216\u503c&#xff0c;\u800c\u4e0d\u662f\u952e\u503c\u5bf9&#xff0c;\u53ef\u4ee5\u4f7f\u7528 std::map::keys() \u6216 std::map::values()&#xff08;C&#043;&#043;20\u53ca\u4ee5\u4e0a&#xff09;\u6765\u83b7\u53d6\u952e\u6216\u503c\u7684\u89c6\u56fe&#xff0c;\u5e76\u904d\u5386\u5b83\u4eec\u3002\u7136\u800c&#xff0c;\u8bf7\u6ce8\u610f\u8fd9\u4e9b\u65b9\u6cd5\u5728C&#043;&#043;20\u4e4b\u524d\u7684\u6807\u51c6\u4e2d\u662f\u4e0d\u53ef\u7528\u7684\u3002<\/li>\n<\/ul>\n<p>\u9009\u62e9\u54ea\u79cd\u904d\u5386\u65b9\u5f0f\u53d6\u51b3\u4e8e\u4f60\u7684\u5177\u4f53\u9700\u6c42\u548cC&#043;&#043;\u6807\u51c6\u7248\u672c\u3002\u8303\u56f4for\u5faa\u73af\u901a\u5e38\u662f\u6700\u7b80\u6d01\u548c\u73b0\u4ee3\u7684\u65b9\u5f0f&#xff0c;\u4f46\u8fed\u4ee3\u5668\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u7075\u6d3b\u6027\u548c\u63a7\u5236\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.5k\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u5728C++\u4e2d\uff0cstd::map\u662f\u4e00\u79cd\u5173\u8054\u5bb9\u5668\uff0c\u5b83\u5b58\u50a8\u7684\u662f\u952e\u503c\u5bf9\uff08key-value pairs\uff09\uff0c\u5e76\u4e14\u6309\u952e\u7684\u987a\u5e8f\u8fdb\u884c\u6392\u5e8f\u3002\u904d\u5386std::map\u3002_c++ map\u904d\u5386<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,4232,4233,3759,4234,3713],"topic":[],"class_list":["post-44929","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-c-stl","tag-map","tag-stl","tag-4234","tag-3713"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/44929.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.5k\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u5728C++\u4e2d\uff0cstd::map\u662f\u4e00\u79cd\u5173\u8054\u5bb9\u5668\uff0c\u5b83\u5b58\u50a8\u7684\u662f\u952e\u503c\u5bf9\uff08key-value pairs\uff09\uff0c\u5e76\u4e14\u6309\u952e\u7684\u987a\u5e8f\u8fdb\u884c\u6392\u5e8f\u3002\u904d\u5386std::map\u3002_c++ map\u904d\u5386\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/44929.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-20T22:06:28+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/44929.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/44929.html\",\"name\":\"C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-20T22:06:28+00:00\",\"dateModified\":\"2025-06-20T22:06:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/44929.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/44929.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/44929.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/44929.html","og_locale":"zh_CN","og_type":"article","og_title":"C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.5k\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf9\u6b21\u3002\u5728C++\u4e2d\uff0cstd::map\u662f\u4e00\u79cd\u5173\u8054\u5bb9\u5668\uff0c\u5b83\u5b58\u50a8\u7684\u662f\u952e\u503c\u5bf9\uff08key-value pairs\uff09\uff0c\u5e76\u4e14\u6309\u952e\u7684\u987a\u5e8f\u8fdb\u884c\u6392\u5e8f\u3002\u904d\u5386std::map\u3002_c++ map\u904d\u5386","og_url":"https:\/\/www.wsisp.com\/helps\/44929.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-20T22:06:28+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/44929.html","url":"https:\/\/www.wsisp.com\/helps\/44929.html","name":"C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-20T22:06:28+00:00","dateModified":"2025-06-20T22:06:28+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/44929.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/44929.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/44929.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C++\u4e2d\u5982\u4f55\u904d\u5386map\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/44929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=44929"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/44929\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=44929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=44929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=44929"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=44929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}