{"id":883,"date":"2018-03-19T23:37:47","date_gmt":"2018-03-19T15:37:47","guid":{"rendered":"http:\/\/www.whudj.cn\/?p=883"},"modified":"2018-03-19T23:37:47","modified_gmt":"2018-03-19T15:37:47","slug":"c%e7%bc%96%e7%a0%81%e8%a7%84%e8%8c%83","status":"publish","type":"post","link":"http:\/\/www.whudj.cn\/?p=883","title":{"rendered":"C++\u7f16\u7801\u89c4\u8303"},"content":{"rendered":"<p>\u8fd1\u671f\uff0c\u5728\u5c0f\u7ec4\u5185\u505a\u4e86\u4e00\u671f\u5173\u4e8e\u7f16\u7801\u89c4\u8303\u7684\u5c0f\u57f9\u8bad\uff0c\u5c06\u7f16\u5199\u7684\u7f16\u7801\u89c4\u8303\u6587\u4ef6\u5206\u4eab\u4e0e\u4e0b\u6587\u3002\u7ec4\u5185\u6210\u5458\u6709\u4e0d\u540c\u7684\u80cc\u666f\u548c\u98ce\u683c\uff0c\u56e0\u6b64\u51e0\u4e2a\u5de5\u7a0b\u7684\u7f16\u7801\u98ce\u683c\u8fe5\u5f02\uff0c\u4e0d\u4e4f\u6709\u4e00\u4e9b\u4e0d\u89c4\u8303\uff0c\u6709\u98ce\u9669\u7684\u5730\u65b9\u3002\u76ee\u524d\u7f51\u4e0a\u6d41\u884c\u7684\u7f16\u7801\u89c4\u8303\u4e00\u822c\u5927\u800c\u5168\uff0c\u8003\u8651\u5230\u4e0d\u5f71\u54cd\u73b0\u6709\u5de5\u4f5c\u8fdb\u884c\uff0c\u5faa\u5e8f\u6e10\u8fdb\u7684\u6539\u8fdb\u65b9\u6cd5\uff0c\u6211\u5c3d\u91cf\u9009\u62e9\u4e86\u91cd\u8981\u7684\u6761\u76ee\uff0c\u5e76\u4e14\u8fdb\u884c\u4e86\u5206\u7ea7\u3002\u7ed3\u5408\u7ec4\u5185\u5b9e\u9645\u60c5\u51b5\uff0c\u7a81\u51fa\u4e86\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u672f\u8bed\uff1a<\/h2>\n<p>\u539f\u5219\uff1a\u7f16\u7a0b\u65f6\u8981\u9075\u5faa\u7684\u6307\u5bfc\u601d\u60f3<\/p>\n<p>\u5efa\u8bae\uff1a\u5904\u4e8e\u4ee3\u7801\u53ef\u8bfb\u6027\uff0c\u6027\u80fd\u65b9\u9762\u7ed9\u51fa\u7684\u5efa\u8bae\u3002<\/p>\n<p>\u89c4\u5219\uff1a\u7f16\u7a0b\u4e2d\u5e94\u8be5\u6267\u884c\u7684\u7f16\u7801\u89c4\u5219\u3002<\/p>\n<p><strong><span style=\"color: #ff0000;\">\u5f3a\u5236\uff1a\u7f16\u7a0b\u4e2d\u5fc5\u987b\u6267\u884c\u7684\u7f16\u7801\u89c4\u5219\u3002<\/span><\/strong><\/p>\n<p><strong><span style=\"color: #ff0000;\">\u7981\u6b62\uff1a\u4e00\u65e6\u89e6\u72af\uff0c\u4f1a\u5f15\u53d1\u4e25\u91cd\u9519\u8bef\u7684\u3002<\/span><\/strong><\/p>\n<p>\u80cc\u666f\uff1a\u4e3a\u8bf4\u660e\u60c5\u51b5\u8865\u5145\u7684\u80cc\u666f\u77e5\u8bc6\u3002<\/p>\n<h2>\u7f16\u7801\u539f\u5219<\/h2>\n<p>1.\u3010\u539f\u5219\u3011\u6e05\u6670\u7b2c\u4e00\uff1a\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u4ee3\u7801\u7684\u53ef\u9605\u8bfb\u6027\u9ad8\u4e8e\u6027\u80fd\u3002<\/p>\n<p>2.\u3010\u539f\u5219\u3011\u7b80\u6d01\u4e3a\u7f8e\uff1a\u7b80\u6d01\u5c31\u662f\u5229\u4e8e\u7406\u89e3\u5e76\u4e14\u5229\u4e8e\u5b9e\u73b0\u3002<\/p>\n<p>3.\u3010\u539f\u5219\u3011\u9009\u62e9\u5408\u9002\u7684\u98ce\u683c\uff0c\u4e0e\u4ee3\u7801\u539f\u6709\u98ce\u683c\u4e00\u81f4\u3002\u5982\u679c\u91cd\u6784\u4ee3\u7801\u65f6\uff0c\u660e\u667a\u7684\u4f5c\u6cd5\u662f\u4f9d\u636e\u73b0\u6709\u98ce\u683c\u7ee7\u7eed\u7f16\u7801\u3002<\/p>\n<h2>\u65e5\u5fd7<\/h2>\n<p>1.\u3010\u80cc\u666f\u3011\u65e5\u5fd7\u7684\u4f5c\u7528\uff1a1\uff09\u5b9a\u4f4d\u95ee\u9898 2\uff09\u6027\u80fd\u5206\u6790\u3002<\/p>\n<p>2.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u91cd\u8981\u7684\u5904\u7406\u73af\u8282 \u4e00\u5b9a\u8981\u6709\u542f\u52a8\uff0c\u7ed3\u675f\u65e5\u5fd7\u3002<span style=\"color: #339966;\">\uff08\u5bf9\u7a0b\u5e8f\u5d29\u6e83\u5b9a\u4f4d\u975e\u5e38\u6709\u6548\uff09<\/span><\/p>\n<p>3.\u3010\u5efa\u8bae\u3011\u907f\u514d\u5728\u5927\u5faa\u73af\u4e2d\u5199\u65e0\u5173\u7d27\u8981\u7684\u65e5\u5fd7\u3002<\/p>\n<h2>\u6ce8\u91ca<\/h2>\n<p>1.\u3010\u539f\u5219\u3011\u5c3d\u91cf\u8ba9\u4ee3\u7801\u62e5\u6709\u81ea\u89e3\u91ca\u80fd\u529b\u3002<\/p>\n<p>2.\u3010\u539f\u5219\u3011\u5728\u4ee3\u7801\u7684\u529f\u80fd\u3001\u610f\u56fe\u5c42\u6b21\u4e0a\u8fdb\u884c\u6ce8\u91ca\uff0c\u5373\u6ce8\u91ca\u89e3\u91ca\u4ee3\u7801\u96be\u4ee5\u76f4\u63a5\u8868\u8fbe\u7684\u610f\u56fe\uff0c\u800c\u4e0d\u662f\u91cd\u590d\u63cf\u8ff0\u4ee3\u7801\u3002<\/p>\n<p>3.\u3010\u89c4\u5219\u3011\u4fee\u6539\u4ee3\u7801\u65f6\uff0c\u7ef4\u62a4\u4ee3\u7801\u5468\u8fb9\u7684\u6240\u6709\u6ce8\u91ca\uff0c\u4ee5\u4fdd\u8bc1\u6ce8\u91ca\u4e0e\u4ee3\u7801\u7684\u4e00\u81f4\u6027\u3002\u4e0d\u518d\u6709\u7528\u7684\u6ce8\u91ca\u8981\u5220\u9664\u3002<\/p>\n<p>4.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>public\u51fd\u6570\u4e00\u5b9a\u8981\u6709\u6ce8\u91ca\uff0c\u8bf4\u660e\u529f\u80fd\u53ca\u7528\u6cd5\uff0c\u8f93\u5165\uff0c\u8f93\u51fa\uff0c\u8fd4\u56de\u503c\u7684\u610f\u4e49\u3002<span style=\"color: #339966;\">\uff08\u5176\u5b9e\uff0c\u8fd9\u4e5f\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u52a0\u6ce8\u610f\u8bbf\u95ee\u6743\u9650\u63a7\u5236\uff0c\u5982\u975e\u5fc5\u8981\uff0c\u4f60\u80af\u5b9a\u4e0d\u4f1a\u201c\u9ed8\u8ba4\u201d\u91c7\u7528public\u5173\u952e\u5b57\u7684\uff09<\/span><\/p>\n<p>5.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u5173\u952e\u7b97\u6cd5\u6a21\u5757\u4e00\u5b9a\u8981\u6709\u6ce8\u91ca\uff0c\u5c24\u5176\u5728\u53c2\u6570\u503c\u3001\u7279\u5b9a\u60c5\u51b5\u5b58\u5728\u7684\u60c5\u51b5\u4e0b\u3002<span style=\"color: #339966;\">\uff08\u5982\u679c\u7b97\u6cd5\u662f\u9488\u5bf9\u67d0\u79cd\u7279\u6b8a\u60c5\u51b5\u8fdb\u884c\u5904\u7406\u7684\uff0c\u90a3\u4e48\u8bf4\u660e\u8fd9\u4e2a\u60c5\u51b5\u662f\u975e\u5e38\u6709\u5fc5\u8981\u8bf4\u660e\u7684\uff09<\/span><\/p>\n<h2>\u5934\u6587\u4ef6<\/h2>\n<p>1.\u3010\u5efa\u8bae\u3011\u5934\u6587\u4ef6\u4e2d\u9002\u5408\u653e\u7f6e\u63a5\u53e3\u7684\u58f0\u660e\uff0c\u4e0d\u9002\u5408\u653e\u7f6e\u5b9e\u73b0\u3002<span style=\"color: #339966;\">\uff08\u5373\u4f7f\u662f\u6a21\u677f\u7c7b\uff0c\u4e5f\u4f1a\u5728\u5934\u6587\u4ef6\u4e2dinclude .hpp\u6587\u4ef6\u7684\u65b9\u5f0f\u4fdd\u8bc1\u5934\u6587\u4ef6\u53ea\u6709\u58f0\u660e\u3002\u5982\u679c\u662f\u975e\u6a21\u677f\u7c7b\uff0c\u4f60\u53ef\u80fd\u4f1a\u83b7\u5f97\u65b9\u6cd5\u5df2\u7ecf\u5b9a\u4e49\u7684\u9519\u8bef\uff09<\/span><\/p>\n<p>2.\u3010\u5efa\u8bae\u3011\u5934\u6587\u4ef6\u5e94\u5f53\u804c\u8d23\u5355\u4e00\u3002<span style=\"color: #339966;\">\uff08\u201c\u5355\u4e00\u201d\u7684\u7c92\u5ea6\u5e94\u8be5\u6bd4\u8f83\u5c0f\uff0c\u800c\u975e\u5355\u4e00\u7684\u505a\u4e00\u4ef6\u975e\u5e38\u5927\u7684\u4e8b\u60c5\uff09<\/span><\/p>\n<p>3.\u3010\u89c4\u5219\u3011\u6bcf\u4e00\u4e2a.cpp\u6587\u4ef6\u5e94\u6709\u4e00\u4e2a\u540c\u540d.h\u6587\u4ef6\uff0c\u7528\u4e8e\u58f0\u660e<\/p>\n<p>4.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>.cpp\/.h\u6587\u4ef6\u7981\u6b62\u5305\u542b\u7528\u4e0d\u5230\u7684\u5934\u6587\u4ef6\u3002<span style=\"color: #339966;\">\uff08\u8fd9\u79cd\u4e0d\u4ec5\u4f1a\u5e26\u6765\u989d\u5916\u7684\u7f16\u8bd1\u9884\u5904\u7406\u65f6\u95f4\uff0c\u800c\u4e14\u4e5f\u53ef\u80fd\u7ed9\u5f15\u7528\u8005\u5e26\u6765\u4e0d\u5c0f\u7684\u9ebb\u70e6\uff09<\/span><\/p>\n<p>5.\u3010\u89c4\u5219\u3011\u5934\u6587\u4ef6\u5e94\u5f53\u81ea\u5305\u542b\uff08\u81ea\u7ed9\u81ea\u8db3\uff09\u3002<\/p>\n<p>6.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u7981\u6b62\u5728\u5934\u6587\u4ef6\u4e2d\u5b9a\u4e49\u53d8\u91cf\u3002<span style=\"color: #339966;\">(static\u53d8\u91cf\u9664\u5916\uff0c\u56e0\u4e3astatic\u53d8\u91cf\u4e0d\u4f1a\u5f15\u53d1\u91cd\u5b9a\u4e49\u95ee\u9898)<\/span><\/p>\n<p>7.\u3010\u89c4\u5219\u3011\u4f7f\u7528\u524d\u7f6e\u58f0\u660e\uff08forward declarations\uff09\u5c3d\u91cf\u51cf\u5c11.h\u6587\u4ef6\u4e2d#include\u7684\u6570\u91cf\u3002<span style=\"color: #339966;\">\uff08\u6269\u5c55\uff1a\u54ea\u4e9b\u60c5\u51b5\u53ef\u4ee5\u4f7f\u7528\u524d\u7f6e\u58f0\u660e\uff1f<\/span><\/p>\n<ol>\n<li><span style=\"color: #339966;\">\u6570\u636e\u7c7b\u578b\u4e3a\u6307\u9488\u3001\u5f15\u7528\u7c7b\u578b\u65f6<\/span><\/li>\n<li><span style=\"color: #339966;\">\u6570\u636e\u7c7b\u578b\u4e3a\u51fd\u6570\u7684\u53c2\u6570\u3001\u8fd4\u56de\u503c\u7c7b\u578b\u65f6<\/span><\/li>\n<li><span style=\"color: #339966;\">\u6570\u636e\u7c7b\u578b\u4e3a\u9759\u6001\u6210\u5458\u7c7b\u578b\u65f6\uff0c\u56e0\u4e3a\u9759\u6001\u6210\u5458\u7c7b\u578b\u7684\u5b9a\u4e49\u5728\u7c7b\u5916\u3002\uff09<\/span><\/li>\n<\/ol>\n<p>8.\u3010\u89c4\u5219\u3011\u56e0\u4e3a\u6709\u6a21\u677f\u5b58\u5728\u5fc5\u987b\u4f7f\u7528hpp\u7684\u6587\u4ef6\uff0c\u5df2\u5b58\u5728\u7684\u91c7\u7528\u58f0\u660e\u548c\u5b9a\u4e49\u5206\u5f00\u7684\u65b9\u5f0f\u3002\u65b0\u5efa\u7684\u91c7\u7528 .h\u58f0\u660e\uff0c\u6700\u540e#include .hpp\u7684\u65b9\u5f0f\u3002<\/p>\n<h2>\u4f5c\u7528\u57df<\/h2>\n<p>1.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u7981\u6b62\u5728\u5934\u6587\u4ef6\u6216\u8005#include \u4e4b\u524d\u4f7f\u7528 using namespace xxx\u3002<span style=\"color: #339966;\">\uff08\u8fd9\u6837\u7b49\u4e8e\u201c\u81ea\u5e9f\u6b66\u529f\u201d\uff09<\/span><\/p>\n<h2>\u51fd\u6570<\/h2>\n<p>1.\u3010\u89c4\u5219\u3011\u4e00\u4e2a\u51fd\u6570\u4ec5\u5b8c\u6210\u4e00\u4ef6\u529f\u80fd\u3002<span style=\"color: #339966;\">\uff08\u8fd9\u6837\u4fdd\u8bc1\u4e86\u51fd\u6570\u88ab\u4f7f\u7528\u7684\u8303\u56f4\u5c3d\u91cf\u5e7f\uff09<\/span><\/p>\n<p>2.\u3010\u89c4\u5219\u3011\u91cd\u590d\u4ee3\u7801\u5e94\u8be5\u5c3d\u53ef\u80fd\u63d0\u70bc\u6210\u51fd\u6570\u3002<\/p>\n<p>3.\u3010\u89c4\u5219\u3011\u907f\u514d\u51fd\u6570\u8fc7\u957f\uff0c\u51fd\u6570\u4e0d\u8d85\u8fc7200\u884c\uff08\u4e0d\u542b\u6ce8\u91ca\u884c\uff0c\u7a7a\u884c\uff09\u3002<span style=\"color: #339966;\">\uff08\u7f51\u4e0a\u5e7f\u4e3a\u6d41\u4f20\u7684\u534e\u4e3a\u516c\u53f8\u7684\u89c4\u8303\u4e3a\u4e0d\u8d85\u8fc750\u884c\u3002\u4f46\u534e\u4e3a\u89c4\u8303\u540c\u65f6\u8bf4\u4e1a\u5185\u6d41\u884c\u7684\u6807\u51c6\u4e3a\u4e0d\u8d85\u8fc7\u4e00\u5c4f\uff09<\/span><\/p>\n<p>4.\u3010\u89c4\u5219\u3011\u907f\u514d\u51fd\u6570\u7684\u4ee3\u7801\u5757\u5d4c\u5957\u8fc7\u6df1\uff0c\u51fd\u6570\u7684\u4ee3\u7801\u5757\u5d4c\u5957\u4e0d\u8d85\u8fc74\u5c42\u3002<span style=\"color: #339966;\">\uff08\u6211\u4eec\u5728\u9605\u8bfb\u4ee3\u7801\u65f6\uff0c\u4e5f\u50cf\u6267\u884c\u4ee3\u7801\u4e00\u6837\u4fdd\u5b58\u4e86\u201c\u6808\u201d\uff0c\u8fc7\u6df1\u7684\u5d4c\u5957\u8d85\u51fa\u4e86\u6211\u4eec\u7684\u8111\u529b\u2026\u2026\uff09<\/span><\/p>\n<p>5.\u3010\u89c4\u5219\u3011\u5e9f\u5f03\u4ee3\u7801\uff08\u6ca1\u6709\u88ab\u8c03\u7528\u7684\u51fd\u6570\u548c\u53d8\u91cf)\u8981\u53ca\u65f6\u6e05\u9664\u3002<\/p>\n<p>6.\u3010\u5efa\u8bae\u3011\u51fd\u6570\u7684\u53c2\u6570\u4e2a\u6570\u4e0d\u8d85\u8fc75\u4e2a(\u907f\u514d\u6df7\u6dc6)<\/p>\n<p>7.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u5bf9\u4f20\u5165\u53c2\u6570\u8fdb\u884c\u5408\u6cd5\u6027\u68c0\u67e5\u3002<span style=\"color: #339966;\">\uff08\u6211\u4eec\u5f88\u591a\u7a0b\u5e8f\u7684\u5d29\u6e83\u5747\u662f\u8fd9\u4e2a\u539f\u56e0\u6784\u6210\u7684\uff09<\/span><\/p>\n<p>8.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u5bf9\u975e\u4f20\u5165\u53c2\u6570\u8fdb\u884c\u5408\u6cd5\u6027\u68c0\u67e5\u3002<\/p>\n<p>9.\u3010\u5efa\u8bae\u3011\u5bf9\u6587\u4ef6\u5185\u90e8\u51fd\u6570\u4f7f\u7528 static\u5173\u952e\u5b57<span style=\"color: #339966;\">\uff08static\u7528\u6765\u8868\u793a\u51fd\u6570\u7684\u4f5c\u7528\u57df\u4e3a\u6587\u4ef6\u5185\uff09<\/span><\/p>\n<p>10.\u3010\u5efa\u8bae\u3011\u5bf9\u4e8e\u77ed\u5c0f\u7684\u5e76\u4e14\u5728\u5927\u5faa\u73af\u4e2d\u8c03\u7528\u7684\u51fd\u6570\u53ef\u4ee5\u91c7\u7528inline\u65b9\u5f0f\u3002<span style=\"color: #339966;\">\uff08inline\u5373\u7528\u51fd\u6570\u4fdd\u8bc1\u4e86\u7b80\u6d01\u6027\uff0c\u800c\u4e14\u4e5f\u4fdd\u8bc1\u4e86\u6548\u7387\u3002\u5176\u5b9e\uff0c\u7f16\u8bd1\u5668\u4f1a\u81ea\u884c\u51b3\u5b9a\u54ea\u4e9b\u51fd\u6570\u88ab\u5185\u8054\uff09<\/span><\/p>\n<h2>\u51fd\u6570\u547d\u540d<\/h2>\n<p>1.\u3010\u89c4\u5219\u3011\u540d\u79f0\u7b2c\u4e00\u4e2a\u5355\u8bcd\u5fc5\u987b\u662f\u52a8\u8bcd\u6216\u8005\u52a8\u540d\u8bcd\u3002<\/p>\n<h2>\u5bf9\u8c61<\/h2>\n<p>1.\u3010\u89c4\u5219\u3011\u5c3d\u53ef\u80fd\u4f7f\u7528const.\u51fd\u6570\u4f20\u53c2\u5c3d\u91cf\u4f7f\u7528const \u5f15\u7528\u4ee3\u66ff\u4f20\u503c\u3002\u4f46\u5bf9\u4e8e\u5185\u7f6e\u7c7b\u578b\uff0cSTL\u8fed\u4ee3\u5668\uff0c\u51fd\u6570\u5bf9\u8c61\uff0c\u4f20\u503c\u7684\u6548\u7387\u66f4\u9ad8\u4e00\u4e9b\u3002<span style=\"color: #339966;\">\uff08const \u51fd\u6570\u7684\u5185\u90e8\u4ec5\u5141\u8bb8\u4f7f\u7528const\u7c7b\u578b\u7684\u51fd\u6570\uff08\u672c\u7c7b\uff09\uff0c\u8fd9\u6837\u4f1a\u5f62\u6210const\u8c03\u7528\u94fe\u2026\u2026\u8fd9\u6b63\u662f\u5176\u9b45\u529b\u6240\u5728\uff09<\/span><\/p>\n<p>2.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u786e\u4fdd\u5bf9\u8c61\u88ab\u4f7f\u7528\u524d\u5df2\u88ab\u521d\u59cb\u5316\u3002<span style=\"color: #339966;\">\uff08\u5b9a\u4e49\u4e0e\u51fd\u6570\u4f53\u5185\u90e8\u7684\u5185\u7f6e\u7c7b\u578b(\u5373POD,plain old data\u7c7b\u578b)\u5c06\u4e0d\u4f1a\u88ab\u521d\u59cb\u5316\uff09<\/span><\/p>\n<h2>\u53d8\u91cf<\/h2>\n<p>1.\u3010\u5efa\u8bae\u3011\u4e0d\u7528\u6216\u8005\u5c11\u7528\u5168\u5c40\u53d8\u91cf\u3002<\/p>\n<p>2.\u3010\u5efa\u8bae\u3011\u7ed3\u6784\u529f\u80fd\u5355\u4e00\uff1b\u4e0d\u8981\u8bbe\u8ba1\u9762\u9762\u4ff1\u5230\u7684\u6570\u636e\u7ed3\u6784\u3002 <span style=\"color: #339966;\">\uff08\u8fd9\u6837\u4e0d\u80fd\u8d77\u5230\u7ed3\u6784\u590d\u7528\u7684\u76ee\u7684\uff0c\u800c\u4e14\u4f7f\u5f97\u6570\u636e\u7ed3\u6784\u7684\u610f\u56fe\u542b\u7cca\u4e0d\u6e05\uff09<\/span><\/p>\n<p>3.\u3010\u5efa\u8bae\u3011\u5c3d\u53ef\u80fd\u5c40\u90e8\u7684\u58f0\u660e\u53d8\u91cf\u3002<\/p>\n<p>\u3010\u80cc\u666f\u3011C99\u4ee5\u524d\u7684c\u8bed\u8a00\u7248\u672c\u66fe\u7ecf\u8981\u6c42\u53ea\u80fd\u5728\u4f5c\u7528\u57df\u5f00\u59cb\u5904\u5b9a\u4e49\u53d8\u91cf\uff0c\u56e0\u6b64\u6709\u7684\u7a0b\u5e8f\u4f1a\u5728\u51fd\u6570\u5f00\u59cb\u5904\u5b9a\u4e49\u6240\u6709\u4f7f\u7528\u7684\u53d8\u91cf\u3002\u5927\u5bb6\u73b0\u5728\u6ca1\u5fc5\u8981\u9075\u5faa\u8fd9\u79cd\u5199\u6cd5\u3002<\/p>\n<h2>\u53d8\u91cf\u547d\u540d<\/h2>\n<p>1.\u3010\u5efa\u8bae\u3011\u4e0d\u5efa\u8bae\u4f7f\u7528\u5308\u7259\u5229\u547d\u540d\u6cd5\u3002<span style=\"color: #339966;\">\uff08\u56e0\u4e3a\u5308\u7259\u5229\u547d\u540d\u6cd5\u5c06\u7c7b\u578b\u5199\u5728\u547d\u540d\u4e2d\u7684\u505a\u6cd5\u4f1a\u7ed9\u7c7b\u578b\u4fee\u6539\u65f6\u5e26\u6765\u4e0d\u4fbf\uff09<\/span><\/p>\n<p>2.\u3010\u89c4\u5219\u3011\u6807\u8bc6\u7b26\u7684\u547d\u540d\u8981\u6e05\u6670\u3001\u660e\u4e86\uff0c\u6709\u660e\u786e\u542b\u4e49\uff0c\u540c\u65f6\u4f7f\u7528\u5b8c\u6574\u7684\u5355\u8bcd\u6216\u5927\u5bb6\u57fa\u672c\u53ef\u4ee5\u7406\u89e3\u7684\u7f29\u5199\uff0c\u907f\u514d\u4f7f\u4eba\u4ea7\u751f\u8bef\u89e3\u3002<\/p>\n<p>3.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u9664\u4e86\u5e38\u89c1\u7684\u901a\u7528\u7f29\u5199\u4ee5\u5916\uff0c\u4e0d\u4f7f\u7528\u5355\u8bcd\u7f29\u5199\uff0c\u4e0d\u5f97\u4f7f\u7528\u6c49\u8bed\u62fc\u97f3<\/p>\n<p>4.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u7981\u6b62\u4f7f\u7528\u5355\u5b57\u8282\u547d\u540d\u53d8\u91cf\uff0c\u4f46\u5141\u8bb8\u5b9a\u4e49i\u3001j\u3001k\u4f5c\u4e3a\u5c40\u90e8\u5faa\u73af\u53d8\u91cf\u3002<\/p>\n<p>5.\u3010\u5efa\u8bae\u3011\u7c7b\u7684\u6210\u5458\u53d8\u91cf\u5c3d\u91cf\u4ee5\u201cm_\u201d\u5f00\u59cb<\/p>\n<h2>\u5b8f<\/h2>\n<p>1.\u3010\u5efa\u8bae\u3011\u5e38\u91cf\u5efa\u8bae\u4f7f\u7528const\u5b9a\u4e49\u4ee3\u66ff\u5b8f\u3002<\/p>\n<p>2.\u3010\u5efa\u8bae\u3011\u9664\u975e\u5fc5\u8981\uff0c\u5e94\u5c3d\u53ef\u80fd\u4f7f\u7528\u51fd\u6570\u4ee3\u66ff\u5b8f\u3002<span style=\"color: #339966;\">\uff08\u7528\u5b8f\u65f6\uff0c\u5f88\u53ef\u80fd\u5e26\u6765\u610f\u5916\u7684\u6548\u679c\uff09<\/span><\/p>\n<p>3.<span style=\"color: #ff0000;\">\u3010\u5f3a\u5236\u3011<\/span>\u907f\u514d\u4f7f\u7528\u201c\u9b54\u6570\u201d\u3002<span style=\"color: #339966;\">\uff08\u5c24\u5176\u662f\u5728\u7b97\u6cd5\u7c7b\u7684\u7a0b\u5e8f\u4e2d\uff0c\u4f7f\u7528\u53c2\u6570\u65f6\u76f4\u63a5\u5199\u6570\u5b57\u76f8\u8f83\u91c7\u7528\u53d8\u91cf\u5b9a\u4e49\u53c2\u6570\uff0c\u7136\u540e\u4f20\u5165\u96be\u7406\u89e3\u7684\u591a\uff09<\/span><\/p>\n<h2>\u5185\u5b58\u7ba1\u7406<\/h2>\n<p>1.<span style=\"color: #ff0000;\">\u3010\u7981\u6b62\u3011<\/span>\u7981\u6b62\u5185\u5b58\u64cd\u4f5c\u8d8a\u754c\u3002\u5c24\u5176\u5728\u8bbf\u95ee\u6570\u7ec4\u65f6\uff0c\u4e0d\u5f97\u5728\u6ca1\u6709\u5224\u65ad\u6570\u7ec4\u662f\u5426\u4e3a\u7a7a\u7684\u60c5\u51b5\u4e0b\u8bbf\u95ee\u9996\u5143\u7d20\u3002\u5728\u6570\u7ec4\u5143\u7d20\u4e2a\u6570\u53ef\u80fd\u53d1\u751f\u6539\u53d8\u7684\u5faa\u73af\u4e2d\uff0c\u9700\u8981\u614e\u91cd\u8003\u8651\u4e0b\u6807\/\u8fed\u4ee3\u5668\u7684\u6709\u6548\u6027\u3002<\/p>\n<p>2.<span style=\"color: #ff0000;\">\u3010\u7981\u6b62\u3011<\/span>\u7981\u6b62\u5185\u5b58\u6cc4\u9732\u3002\u5728\u5806\u4e0a\u7533\u8bf7\u7684\u5bf9\u8c61\u8981\u9002\u65f6\u91ca\u653e\u3002<\/p>\n<p>3.<span style=\"color: #ff0000;\">\u3010\u7981\u6b62\u3011<\/span>\u7981\u6b62\u5f15\u7528\u5df2\u7ecf\u91ca\u653e\u7684\u5185\u5b58\u7a7a\u95f4\u3002\u91ca\u653e\u5bf9\u8c61\u65f6\u614e\u91cd\u8003\u8651\u5176\u4ed6\u53ef\u80fd\u4fdd\u7559\u5f15\u7528\u7684\u5bf9\u8c61\u3002<\/p>\n<h2>\u7a0b\u5e8f\u4f18\u5316<\/h2>\n<p>1.\u3010\u539f\u5219\u3011\u5728\u4fdd\u8bc1\u7a0b\u5e8f\u6b63\u786e\u6027\u3001\u7b80\u6d01\u3001\u53ef\u7ef4\u62a4\u3001\u53ef\u6d4b\u7684\u60c5\u51b5\u4e0b\uff0c\u4f18\u5316\u4ee3\u7801\u6548\u7387\u3002<\/p>\n<p>2.\u3010\u539f\u5219\u3011\u4f18\u5148\u8003\u8651\u5bf9\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\u7684\u4f18\u5316\u6765\u6539\u8fdb\u7a0b\u5e8f\u6548\u7387\u3002<\/p>\n<p>3.\u3010\u539f\u5219\u3011\u5148\u5b9e\u73b0\u6b63\u786e\u7684\u7a0b\u5e8f\uff0c\u540e\u8003\u8651\u4f18\u5316\u3002\u4e0d\u8981\u4e8c\u8005\u540c\u65f6\u8fdb\u884c\u3002(\u5728\u53c2\u8003\u6587\u732e5\u4e2d\u7b2c\u4e00\u53e5\u8bdd\u5c31\u662f\u201c\u4ee5\u6548\u7387\u4f18\u5316\u4e3a\u540d\uff08\u4f46\u672a\u5b9e\u73b0\uff09\u6240\u72af\u7684\u9519\u8bef\u6bd4\u5176\u4ed6\u4efb\u4f55\u9519\u8bef\u90fd\u591a\u201d)<\/p>\n<h2>\u53c2\u8003\u8d44\u6599\uff1a<\/h2>\n<ol>\n<li>\u300a\u534e\u4e3a\u6280\u672f\u6709\u9650\u516c\u53f8c\u8bed\u8a00\u7f16\u7a0b\u89c4\u8303\u300b<\/li>\n<li>\u300agoogle\u7684C++\u7f16\u7801\u89c4\u8303\u300b<\/li>\n<li>\u300aC++\u7f16\u7a0b\u89c4\u8303101\u6761\u89c4\u5219\u3001\u51c6\u5219\u6700\u4f73\u5b9e\u8df5\u300b<\/li>\n<li>\u300aEffective c++\u300b<\/li>\n<li><a href=\"http:\/\/www.tantalon.com\/pete\/cppopt\/main.htm\">C++ Optimization Strategies and Techniques\uff08\u5173\u4e8ec++\u4f18\u5316\u7684\u5ef6\u4f38\u9605\u8bfb\uff09<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd1\u671f\uff0c\u5728\u5c0f\u7ec4\u5185\u505a\u4e86\u4e00\u671f\u5173\u4e8e\u7f16\u7801\u89c4\u8303\u7684\u5c0f\u57f9\u8bad\uff0c\u5c06\u7f16\u5199\u7684\u7f16\u7801\u89c4\u8303\u6587\u4ef6\u5206\u4eab\u4e0e\u4e0b\u6587\u3002\u7ec4\u5185 &hellip; <a href=\"http:\/\/www.whudj.cn\/?p=883\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"_links":{"self":[{"href":"http:\/\/www.whudj.cn\/index.php?rest_route=\/wp\/v2\/posts\/883"}],"collection":[{"href":"http:\/\/www.whudj.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.whudj.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.whudj.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.whudj.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=883"}],"version-history":[{"count":3,"href":"http:\/\/www.whudj.cn\/index.php?rest_route=\/wp\/v2\/posts\/883\/revisions"}],"predecessor-version":[{"id":887,"href":"http:\/\/www.whudj.cn\/index.php?rest_route=\/wp\/v2\/posts\/883\/revisions\/887"}],"wp:attachment":[{"href":"http:\/\/www.whudj.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.whudj.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=883"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.whudj.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}