{"id":1681,"date":"2016-04-18T15:13:03","date_gmt":"2016-04-18T07:13:03","guid":{"rendered":"http:\/\/myblog.emhct.net.cn\/?p=1681"},"modified":"2016-04-18T15:13:03","modified_gmt":"2016-04-18T07:13:03","slug":"%e3%80%90stl%e3%80%81c%e3%80%91%e4%b8%ba%e5%87%8f%e5%b0%8f%e7%bc%96%e8%af%91%e5%90%8e%e4%ba%a7%e7%94%9f%e4%bb%a3%e7%a0%81%e7%9a%84%e4%bd%93%e7%a7%af%e5%81%9a%e7%9a%84%e4%b8%80%e4%ba%9b%e5%a6%a5","status":"publish","type":"post","link":"http:\/\/myblog.emhct.net.cn\/index.php\/archives\/1681","title":{"rendered":"\u3010STL\u3001C++\u3011\u4e3a\u51cf\u5c0f\u7f16\u8bd1\u540e\u4ea7\u751f\u4ee3\u7801\u7684\u4f53\u79ef\u505a\u7684\u4e00\u4e9b\u59a5\u534f"},"content":{"rendered":"<p>\u597d\u50cf\u4ecevs2010\u5f00\u59cb\uff0cvs\u81ea\u5e26\u7684max\u5b8f\u5c31\u4e0d\u518d\u88ab\u63a8\u8350\u4e3aC++\u4e2d\u4f7f\u7528\u7684\u9996\u9009\uff0c\u800c\u662f\u5c3d\u53ef\u80fd\u7684\u6539\u4e3astd::max\u8fd9\u4e2a\u6a21\u677f\u51fd\u6570\u3002<\/p>\n<p>\u5728effective c++\u4e2d\u4e5f\u8bb2\u5230\u4e86max\u5b8f\u548cstd::max\u4e4b\u95f4\u7684\u5dee\u522b\uff08\u4f46\u6709\u65f6\u4f7f\u7528\u8d77\u6765\uff0c\u8fd8\u662f\u4e0d\u5982max\u5b8f\u6765\u7684\u65b9\u4fbf\uff0c\u5c24\u5176\u662f\u5f53max\u7684\u5165\u53c2\u4e0d\u662f\u540c\u4e00\u4e2a\u7c7b\u578b\u65f6\u3002\uff09<\/p>\n<p>&nbsp;<\/p>\n<p>\u597d\u4e86\uff0c\u8bf4\u6b63\u4e8b\u3002<\/p>\n<p>\u5728vs2010\u4e2d\uff0cstd::max\u88ab\u5b9a\u4e49\u4e3a\u4e00\u4e2a\u6a21\u677f\u51fd\u6570\uff0c\u5176\u4e2d\u51fd\u6570\u7684\u53c2\u6570\u7c7b\u578b\u63a8\u5bfc\u4e3b\u8981\u4f9d\u8d56\u4e8e\u7b2c\u4e00\u4e2a\u53c2\u6570\uff1b\u4e14std::max\u88abinline\u4fee\u9970\u3002\u5728vs\u4e2d\uff0cinline\u7684\u5f3a\u5ea6\u5e76\u6ca1\u6709forceinline\u90a3\u4e48\u5f3a\uff0c\u56e0\u6b64\u7f16\u8bd1\u65f6\uff0c\u7f16\u8bd1\u5668\u5373\u53ef\u80fd\u4f1a\u8ba9\u6a21\u677f\u51fd\u6570\u5c55\u5f00\uff0c\u4e5f\u6709\u53ef\u80fd\u4e0d\u4f1a\u8ba9\u6a21\u677f\u51fd\u6570\u5c55\u5f00\u3002<\/p>\n<p>\u6709\u65f6\u5019\u6709\u4e9b\u5f00\u6e90\u9879\u76ee\u4e2d\uff0c\u5927\u91cf\u7684\u4f7f\u7528\u4e86std::max\uff0c\u8fd9\u4e5f\u4f1a\u8fdb\u4e00\u6b65\u7684\u5bfc\u81f4\u7f16\u8bd1\u901f\u5ea6\u51cf\u6162\uff0c\u7f16\u8bd1\u51fa\u6765\u7684\u6587\u4ef6\u53d8\u5927\uff1b\u8fd9\u91cc\u9762\u9664\u4e86inline\u8fd8\u6709\u4e00\u5b9a\u7684\u539f\u56e0\u548c\u6a21\u677f\u7684\u7279\u6027\u6709\u5173\u3002<\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u7c7b\u95ee\u9898\uff0c\u6709\u4e8b\u4e0d\u5f97\u4e0d\u505a\u51fa\u4e00\u4e9b\u6298\u4e2d\u6216\u59a5\u534f\u3002\u5373\uff0c\u5f53\u675c\u5199\u4e00\u4e2a\u516c\u5171\u51fd\u6570\uff0c\u5728\u8be5\u51fd\u6570\u4e2d\u5c06std::max\u8fdb\u884c\u7279\u4f8b\u5316\uff0c\u4ee5\u6b64\u6765\u8fbe\u5230\u4f18\u5316\u7f16\u8bd1\u7684\u76ee\u7684\u3002\u5047\u8bbe\u5728\u4e0d\u8c03\u6574\u8bf8\u5982fpo\u4e4b\u7c7b\u7684\u4f18\u5316\u53c2\u6570\u65f6\uff0c\u7f16\u8bd1\u5668\u90fd\u4f1a\u4e00\u5b9a\u53ea\u4f1a\u5c06std::max\u8fdb\u884c\u4ec5\u6709\u7684\u6709\u9650\u6b21\u5b9e\u4f8b\u5316\uff0c\u4e14\u4e5f\u53ef\u4ee5\u63a7\u5236\u51fd\u6570\u662f\u5426\u8fdb\u884cinline\u3002\u7f16\u8bd1\u65f6\u4e0d\u4ec5\u52a0\u5feb\u4e86\u7f16\u8bd1\u901f\u5ea6\uff0c\u540c\u65f6\u4e5f\u51cf\u5c0f\u4e86\u7f16\u8bd1\u8f93\u51fa\u6587\u4ef6\u7684\u5927\u5c0f\u3002<\/p>\n<p>\u6240\u4ee5\u5728\u4e00\u4e9b\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u5982\u679c\u5bf9\u7f16\u8bd1\u4ea7\u51fa\u7684\u8981\u6c42\u6bd4\u8f83\u9ad8\uff0c\u6709\u65f6\u4e0d\u5f97\u4e0d\u727a\u7272\u4ee3\u7801\u8bbe\u8ba1\u548c\u53ef\u9605\u8bfb\u6027\u6765\u8fbe\u5230\u76ee\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u50cf\u4ecevs2010\u5f00\u59cb\uff0cvs\u81ea\u5e26\u7684max\u5b8f\u5c31\u4e0d\u518d\u88ab\u63a8\u8350\u4e3aC++\u4e2d\u4f7f\u7528\u7684\u9996\u9009\uff0c\u800c\u662f\u5c3d\u53ef\u80fd\u7684\u6539\u4e3astd::max\u8fd9\u4e2a\u6a21\u677f\u51fd\u6570\u3002 \u5728effective c++\u4e2d\u4e5f\u8bb2\u5230\u4e86max\u5b8f\u548cstd::max\u4e4b\u95f4\u7684\u5dee\u522b\uff08\u4f46\u6709\u65f6\u4f7f\u7528\u8d77\u6765\uff0c\u8fd8\u662f\u4e0d\u5982max\u5b8f\u6765\u7684\u65b9\u4fbf\uff0c\u5c24\u5176\u662f\u5f53max\u7684\u5165\u53c2\u4e0d\u662f\u540c\u4e00\u4e2a\u7c7b\u578b\u65f6\u3002\uff09 &nbsp; \u597d\u4e86\uff0c\u8bf4\u6b63\u4e8b\u3002 \u5728vs &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/myblog.emhct.net.cn\/index.php\/archives\/1681\">read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,50,47],"tags":[],"class_list":["post-1681","post","type-post","status-publish","format-standard","hentry","category-win","category-data_structure_and_algorithm","category-ProgramSkill"],"_links":{"self":[{"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/posts\/1681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1681"}],"version-history":[{"count":1,"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/posts\/1681\/revisions"}],"predecessor-version":[{"id":1682,"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/posts\/1681\/revisions\/1682"}],"wp:attachment":[{"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1681"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/myblog.emhct.net.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}