{"id":1246,"date":"2018-09-07T22:58:39","date_gmt":"2018-09-07T14:58:39","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=1246"},"modified":"2018-09-07T22:58:39","modified_gmt":"2018-09-07T14:58:39","slug":"stl%e4%b8%ad%e4%b8%89%e5%a4%a7%e7%bb%84%e4%bb%b6%e5%ae%b9%e5%99%a8%e8%bf%ad%e4%bb%a3%e5%99%a8%e7%ae%97%e6%b3%95%e7%9a%84%e6%9c%80%e7%ae%80%e5%8d%95%e7%bb%84%e5%90%88%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/cpp\/2018\/09\/07\/2258391246.html","title":{"rendered":"STL\u4e2d\u4e09\u5927\u7ec4\u4ef6(\u5bb9\u5668+\u8fed\u4ee3\u5668+\u7b97\u6cd5)\u7684\u6700\u7b80\u5355\u7ec4\u5408\u4f7f\u7528"},"content":{"rendered":"<p>1\u3001STL\u5168\u79f0\u4e3aStandard Template Library\uff0c\u6807\u51c6\u6a21\u677f\u5e93\uff0cC++\u5f00\u53d1\u4e2d\u6700\u4e3a\u5e38\u7528\u7684\u6807\u51c6\u5e93\uff1b<br \/>\n2\u3001STL\u6709\u70b9\u7c7b\u4f3c\u4e8eObjC\u4e2d\u7684Foundation\u5e93\uff0c\u8bed\u8a00\u4e4b\u95f4\u7684\u7c7b\u6bd4\u6709\u52a9\u7406\u89e3\uff0c\u878d\u6c47\u8d2f\u901a\uff1b<br \/>\n3\u3001STL\u4e2d\u6700\u91cd\u8981\u7684\u4e09\u5927\u7ec4\u4ef6\u4e3a\u5bb9\u5668\u3001\u8fed\u4ee3\u5668\u3001\u7b97\u6cd5\uff1b<br \/>\n4\u3001\u8fed\u4ee3\u5668\u4e3a\u5bb9\u5668\u4e0e\u7b97\u6cd5\u4e4b\u95f4\u7684\u6865\u6881\uff1b<br \/>\n5\u3001\u901a\u8fc7\u4e00\u6bb5\u6700\u7b80\u5355\u7684\u4ee3\u7801\u6765\u89e3\u91ca\u4e09\u8005\u4e4b\u95f4\u7684\u534f\u4f5c\u5173\u7cfb\uff1b<\/p>\n<pre lang=\"cpp\" line=\"1\">#include <iostream>\r\n#include <algorithm>\r\nusing namespace std;\r\n\r\nint main(){\r\n    \/\/ 1\u3001\u5bb9\u5668\r\n    string str(\"ABCDEFG\");\r\n    \/\/ 2\u3001\u8fed\u4ee3\u5668\r\n    string::iterator iter = str.begin();\r\n    \/\/ 3\u3001\u7b97\u6cd5([](char c)->void {}\u4e3a\u533f\u540d\u51fd\u6570)\r\n    for_each(iter, iter + 5, [](char c)->void {\r\n        cout << c << '\\t';\r\n    });\r\n    cout << endl;\r\n    return 0;\r\n}<\/pre>\n<p>6\u3001\u8fd0\u884c\u7ed3\u679c\uff1a<br \/>\nA\tB\tC\tD\tE<br \/>\nProgram ended with exit code: 0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001STL\u5168\u79f0\u4e3aStandard Template Library\uff0c\u6807\u51c6\u6a21\u677f\u5e93\uff0cC++\u5f00\u53d1\u4e2d\u6700\u4e3a\u5e38\u7528\u7684\u6807\u51c6\u5e93\uff1b 2\u3001STL\u6709\u70b9\u7c7b\u4f3c\u4e8eObjC\u4e2d\u7684Foundation\u5e93\uff0c\u8bed\u8a00\u4e4b\u95f4\u7684\u7c7b\u6bd4\u6709\u52a9\u7406\u89e3\uff0c\u878d\u6c47\u8d2f\u901a\uff1b 3\u3001STL\u4e2d\u6700\u91cd\u8981\u7684\u4e09\u5927\u7ec4\u4ef6\u4e3a\u5bb9\u5668\u3001\u8fed\u4ee3\u5668\u3001\u7b97\u6cd5\uff1b 4\u3001\u8fed\u4ee3\u5668\u4e3a\u5bb9\u5668\u4e0e\u7b97\u6cd5\u4e4b\u95f4\u7684\u6865\u6881\uff1b 5\u3001\u901a\u8fc7\u4e00\u6bb5\u6700\u7b80\u5355\u7684\u4ee3\u7801\u6765\u89e3\u91ca\u4e09\u8005\u4e4b\u95f4\u7684\u534f\u4f5c\u5173\u7cfb\uff1b #include #include using namespace std; int main(){ \/\/ 1\u3001\u5bb9\u5668 string str(&#8220;ABCDEFG&#8221;); \/\/ 2\u3001\u8fed\u4ee3\u5668 string::iterator iter = str.begin(); \/\/ 3\u3001\u7b97\u6cd5([](char c)->void {}\u4e3a\u533f\u540d\u51fd\u6570) for_each(iter, iter + 5, [](char c)->void { cout<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88],"tags":[104,89,101,103,102],"class_list":["post-1246","post","type-post","status-publish","format-standard","hentry","category-cpp","tag-algorithm","tag-c","tag-iterator","tag-stl","tag-string"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=1246"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1246\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=1246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=1246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=1246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}