{"id":111711,"date":"2022-09-27T20:16:24","date_gmt":"2022-09-27T12:16:24","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=111711"},"modified":"2022-09-27T20:16:50","modified_gmt":"2022-09-27T12:16:50","slug":"a5bb5809e7","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=111711","title":{"rendered":"C++\u6700\u4f73\u5b9e\u8df5 | 2. \u4ee3\u7801\u98ce\u683c"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<section style=\"color: black; line-height: 1.6; letter-spacing: 0px; word-break: break-word; overflow-wrap: break-word; text-align: left; font-size: 14px; padding: 10px; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;\">\n<blockquote style=\"border-top: none; border-bottom: none; font-size: 0.9em; overflow: auto; color: #6a737d; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; border-left-color: rgba(0, 0, 0, 0.65); border-right: 1px solid rgba(0, 0, 0, 0.65); background: #f9f9f9;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; font-size: 14px; color: black; line-height: 26px;\"><em>\u672c\u7cfb\u5217\u662f\u5f00\u6e90\u4e66<span style=\"color: #1e6bb8; font-weight: bold;\">C++ Best Practises<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[1]<\/sup>\u7684\u4e2d\u6587\u7248\uff0c\u5168\u4e66\u4ece\u5de5\u5177\u3001\u4ee3\u7801\u98ce\u683c\u3001\u5b89\u5168\u6027\u3001\u53ef\u7ef4\u62a4\u6027\u3001\u53ef\u79fb\u690d\u6027\u3001\u591a\u7ebf\u7a0b\u3001\u6027\u80fd\u3001\u6b63\u786e\u6027\u7b49\u89d2\u5ea6\u5168\u9762\u4ecb\u7ecd\u4e86\u73b0\u4ee3C++\u9879\u76ee\u7684\u6700\u4f73\u5b9e\u8df5\u3002\u672c\u6587\u662f\u8be5\u7cfb\u5217\u7684\u7b2c\u4e8c\u7bc7\u3002<\/em><\/p>\n<\/blockquote>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; background-color: #000; color: #fff; padding: 2px 10px; width: fit-content; font-size: 17px; margin: 60px auto 10px;\"><\/h3>\n<p style=\"color: #9a9a9a; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; text-align: left; white-space: normal;\">C++\u6700\u4f73\u5b9e\u8df5:<\/p>\n<p style=\"color: #9a9a9a; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; text-align: left; white-space: normal;\">1. \u5de5\u5177<\/p>\n<p style=\"color: #9a9a9a; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; text-align: left; white-space: normal;\">2. \u4ee3\u7801\u98ce\u683c\uff08\u672c\u6587\uff09<\/p>\n<p style=\"color: #9a9a9a; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; text-align: left; white-space: normal;\">3.\u00a0\u5b89\u5168\u6027<\/p>\n<p style=\"color: #9a9a9a; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; text-align: left; white-space: normal;\">4.\u00a0\u53ef\u7ef4\u62a4\u6027<\/p>\n<p style=\"color: #9a9a9a; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; text-align: left; white-space: normal;\">5.\u00a0\u53ef\u79fb\u690d\u6027\u53ca\u591a\u7ebf\u7a0b<\/p>\n<p style=\"color: #9a9a9a; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; text-align: left; white-space: normal;\">6.\u00a0\u6027\u80fd<\/p>\n<p style=\"color: #9a9a9a; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 15px; text-align: left; white-space: normal;\">7.\u00a0\u6b63\u786e\u6027\u548c\u811a\u672c<\/p>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; background-color: #000; color: #fff; padding: 2px 10px; width: fit-content; font-size: 17px; margin: 60px auto 10px;\">\u4ee3\u7801\u98ce\u683c<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4ee3\u7801\u98ce\u683c\u6700\u91cd\u8981\u7684\u662f\u4e00\u81f4\u6027\uff0c\u5176\u6b21\u662f\u9075\u5faaC++\u7a0b\u5e8f\u5458\u4e60\u60ef\u7684\u9605\u8bfb\u98ce\u683c\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">C++\u5141\u8bb8\u4efb\u610f\u957f\u5ea6\u7684\u6807\u8bc6\u7b26\u540d\u79f0\uff0c\u56e0\u6b64\u5728\u547d\u540d\u65f6\u6ca1\u5fc5\u8981\u975e\u8981\u4fdd\u6301\u7b80\u6d01\uff0c\u5efa\u8bae\u4f7f\u7528\u63cf\u8ff0\u6027\u540d\u79f0\uff0c\u5e76\u5728\u98ce\u683c\u4e0a\u4fdd\u6301\u4e00\u81f4\u3002<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; list-style-type: square;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">CamelCase<\/code>(\u9a7c\u5cf0\u547d\u540d\u6cd5)<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">snake_case<\/code>(\u86c7\u5f62\u547d\u540d\u6cd5)<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8fd9\u4e24\u79cd\u662f\u5f88\u5e38\u89c1\u7684\u547d\u540d\u89c4\u8303\uff0c<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">snake_case<\/code>\u7684\u4f18\u70b9\u662f\uff0c\u5728\u9700\u8981\u7684\u65f6\u5019\u53ef\u4ee5\u9002\u914d\u62fc\u5199\u68c0\u67e5\u5668\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u5efa\u7acb\u4ee3\u7801\u98ce\u683c\u6307\u5357<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u65e0\u8bba\u5efa\u7acb\u4ec0\u4e48\u6837\u7684\u4ee3\u7801\u98ce\u683c\u6307\u5357\uff0c\u4e00\u5b9a\u8981\u5b9e\u73b0\u6307\u5b9a\u671f\u671b\u98ce\u683c\u7684<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">.clang-format<\/code>\u6587\u4ef6\u3002\u867d\u7136\u8fd9\u5bf9\u547d\u540d\u6ca1\u6709\u5e2e\u52a9\uff0c\u4f46\u5bf9\u4e8e\u5f00\u6e90\u9879\u76ee\u6765\u8bf4\uff0c\u4fdd\u6301\u4e00\u81f4\u7684\u98ce\u683c\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8bb8\u591aIDE\u3001\u7f16\u8f91\u5668\u90fd\u652f\u6301\u5185\u7f6e\u7684clang-format\uff0c\u6216\u8005\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u901a\u8fc7\u52a0\u8f7d\u9879\u5b89\u88c5\u3002<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; list-style-type: square;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">VSCode: <span style=\"color: #1e6bb8; font-weight: bold;\">Microsoft C\/C++ extension for VS Code<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[2]<\/sup><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">CLion: ClangFormat as alternative formatter<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">VisualStudio: <span style=\"color: #1e6bb8; font-weight: bold;\">ClangFormat<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[3]<\/sup><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">Resharper++: <span style=\"color: #1e6bb8; font-weight: bold;\">Using Clang-Format<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[4]<\/sup><\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">Vim<\/section>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: black; list-style-type: circle;\">\n<li style=\"list-style-type: circle;\">\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><span style=\"color: #1e6bb8; font-weight: bold;\">Format your C family code<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[5]<\/sup><\/section>\n<\/li>\n<li style=\"list-style-type: circle;\">\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><span style=\"color: #1e6bb8; font-weight: bold;\">vim-autoformat<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[6]<\/sup><\/section>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">XCode: <span style=\"color: #1e6bb8; font-weight: bold;\">ClangFormat-Xcode<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[7]<\/sup><\/section>\n<\/li>\n<\/ul>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u901a\u7528C++\u547d\u540d\u7ea6\u5b9a<\/h4>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; list-style-type: square;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u7c7b\u4ee5\u5927\u5199\u5b57\u6bcd\u5f00\u5934: <code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">MyClass<\/code>\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u51fd\u6570\u548c\u53d8\u91cf\u4ee5\u5c0f\u5199\u5b57\u6bcd\u5f00\u5934: <code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">myMethod<\/code>\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5e38\u91cf\u5168\u90e8\u5927\u5199: <code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">const double PI=3.14159265358979323<\/code>\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">C++\u6807\u51c6\u5e93(\u4ee5\u53ca\u5176\u4ed6\u8457\u540dC++\u5e93\uff0c\u5982<span style=\"color: #1e6bb8; font-weight: bold;\">Boost<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[8]<\/sup>)\u4f7f\u7528\u4ee5\u4e0b\u6307\u5bfc\u539f\u5219:<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; list-style-type: square;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5b8f\u4f7f\u7528\u5927\u5199\u548c\u4e0b\u5212\u7ebf: <code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">INT_MAX<\/code>\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u6a21\u677f\u53c2\u6570\u540d\u4f7f\u7528\u9a7c\u5cf0\u547d\u540d\u6cd5: <code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">InputIterator<\/code>\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u6240\u6709\u5176\u4ed6\u540d\u79f0\u90fd\u4f7f\u7528\u86c7\u5f62\u547d\u540d\u6cd5: <code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">unordered_map<\/code>\u3002<\/section>\n<\/li>\n<\/ul>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u533a\u5206\u79c1\u6709\u5bf9\u8c61\u6570\u636e<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">m_<\/code>\u524d\u7f00\u547d\u540d\u79c1\u6709\u6570\u636e\uff0c\u4ee5\u533a\u522b\u4e8e\u516c\u5171\u6570\u636e\uff0c<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">m_<\/code>\u4ee3\u8868\u201cmember\uff08\u6210\u5458\uff09\u201d\u6570\u636e\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u533a\u5206\u51fd\u6570\u53c2\u6570<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6700\u91cd\u8981\u7684\u662f\u4fdd\u6301\u4ee3\u7801\u5e93\u7684\u4e00\u81f4\u6027\uff0c\u8fd9\u662f\u4e00\u79cd\u6709\u52a9\u4e8e\u4fdd\u6301\u4e00\u81f4\u6027\u7684\u65b9\u5f0f\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">t_<\/code>\u524d\u7f00\u547d\u540d\u51fd\u6570\u53c2\u6570\uff0c<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">t_<\/code>\u53ef\u4ee5\u88ab\u8ba4\u4e3a\u662f\u201cthe\u201d\uff0c\u4f46\u5176\u53ef\u4ee5\u8868\u793a\u4efb\u610f\u542b\u4e49\uff0c\u5173\u952e\u662f\u8981\u5c06\u51fd\u6570\u53c2\u6570\u4e0e\u4f5c\u7528\u57df\u5185\u7684\u5176\u4ed6\u53d8\u91cf\u533a\u5206\u5f00\u6765\uff0c\u540c\u65f6\u9075\u5faa\u4e00\u81f4\u7684\u547d\u540d\u7b56\u7565\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u53ef\u4ee5\u4e3a\u56e2\u961f\u9009\u62e9\u4efb\u4f55\u524d\u7f00\u6216\u540e\u7f00\uff0c\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\uff0c\u63d0\u51fa\u4e86\u4e00\u4e2a\u6709\u4e89\u8bae\u7684\u5efa\u8bae\uff0c\u76f8\u5173\u8ba8\u8bba\u89c1<span style=\"color: #1e6bb8; font-weight: bold;\">issue #11<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[9]<\/sup>\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">struct<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">Size<\/span>\n{<\/span>\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0width;\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0height;\n\n\u00a0\u00a0Size(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0t_width,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0t_height)\u00a0:\u00a0width(t_width),\u00a0height(t_height)\u00a0{}\n};\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0This\u00a0version\u00a0might\u00a0make\u00a0sense\u00a0for\u00a0thread\u00a0safety\u00a0or\u00a0something,<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0but\u00a0more\u00a0to\u00a0the\u00a0point,\u00a0sometimes\u00a0we\u00a0need\u00a0to\u00a0hide\u00a0data,\u00a0sometimes\u00a0we\u00a0don't.<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">PrivateSize<\/span>\n{<\/span>\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>:\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">width<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">const<\/span>\u00a0<\/span>{\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0m_width;\u00a0}\n\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">height<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">const<\/span>\u00a0<\/span>{\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0m_height;\u00a0}\n\u00a0\u00a0\u00a0\u00a0PrivateSize(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0t_width,\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0t_height)\u00a0:\u00a0m_width(t_width),\u00a0m_height(t_height)\u00a0{}\n\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0m_width;\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0m_height;\n};\n<\/code><\/pre>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4e0d\u8981\u7528\u4e0b\u5212\u7ebf(_)\u4f5c\u4e3a\u540d\u5b57\u7684\u5f00\u5934<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">_ \u5f00\u5934\u7684\u540d\u5b57\u6709\u53ef\u80fd\u4e0e\u7f16\u8bd1\u5668\u6216\u6807\u51c6\u5e93\u7684\u4fdd\u7559\u540d\u53d1\u751f\u51b2\u7a81: <span style=\"color: #1e6bb8; font-weight: bold;\">What are the rules about using an underscore in a C++ identifier?<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[10]<\/sup><\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u826f\u597d\u4ee3\u7801\u98ce\u683c\u793a\u4f8b<\/h4>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">MyClass<\/span>\n{<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>:\n\u00a0\u00a0MyClass(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0t_data)\n\u00a0\u00a0\u00a0\u00a0:\u00a0m_data(t_data)\n\u00a0\u00a0{\n\u00a0\u00a0}\n\n\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">getData<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">const<\/span>\n\u00a0\u00a0<\/span>{\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0m_data;\n\u00a0\u00a0}\n\n<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0m_data;\n};\n<\/code><\/pre>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4f7fOut-of-Source-Directory\u6784\u5efa<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u786e\u4fdd\u6784\u5efa\u751f\u6210\u7684\u6587\u4ef6\u5b58\u653e\u5728\u4e0e\u6e90\u6587\u4ef6\u5939\u5206\u79bb\u7684\u8f93\u51fa\u6587\u4ef6\u5939\u4e2d\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4f7f\u7528<code>nullptr<\/code><\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">C++11\u5f15\u5165\u4e86<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">nullptr<\/code>\u8868\u793a\u7a7a\u6307\u9488\uff0c\u5e94\u8be5\u7528\u6765\u4ee3\u66ff<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">0<\/code>\u6216<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">NULL<\/code>\u6765\u6307\u793a\u7a7a\u6307\u9488\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u6ce8\u91ca<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6ce8\u91ca\u5757\u5e94\u8be5\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">\/\/<\/code>\uff0c\u800c\u4e0d\u662f<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">\/* *\/<\/code>\uff0c\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">\/\/<\/code>\u53ef\u4ee5\u66f4\u5bb9\u6613\u7684\u5728\u8c03\u8bd5\u65f6\u6ce8\u91ca\u6389\u4ee3\u7801\u5757\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0this\u00a0function\u00a0does\u00a0something<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">myFunc<\/span><span style=\"line-height: 26px;\">()<\/span>\n<\/span>{\n}\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8981\u5728\u8c03\u8bd5\u671f\u95f4\u6ce8\u91ca\u6389\u8fd9\u4e2a\u51fd\u6570\u5757\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a:<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/*\n\/\/\u00a0this\u00a0function\u00a0does\u00a0something\nint\u00a0myFunc()\n{\n}\n*\/<\/span>\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5982\u679c\u51fd\u6570\u5934\u6ce8\u91ca\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">\/* *\/<\/code>\uff0c\u8fd9\u4e48\u505a\u5c31\u4f1a\u6709\u51b2\u7a81\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u6c38\u8fdc\u4e0d\u8981\u5728\u5934\u6587\u4ef6\u4e2d\u4f7f\u7528<code>using namespace<\/code><\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8fd9\u4f1a\u5bfc\u81f4\u6b63\u5728<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">using<\/code>\u7684\u547d\u540d\u7a7a\u95f4\u88ab\u5f3a\u884c\u62c9\u5165\u5230\u5305\u542b\u5934\u6587\u4ef6\u7684\u6240\u6709\u6587\u4ef6\u7684\u547d\u540d\u7a7a\u95f4\u4e2d\uff0c\u4ece\u800c\u9020\u6210\u547d\u540d\u7a7a\u95f4\u6c61\u67d3\uff0c\u5e76\u53ef\u80fd\u5728\u5bfc\u81f4\u540d\u79f0\u51b2\u7a81\u3002\u5728\u5b9e\u73b0\u6587\u4ef6\u4e2d<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">using<\/code>\u547d\u540d\u7a7a\u95f4\u5c31\u8db3\u591f\u4e86\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">Include\u4fdd\u62a4\u7b26<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5934\u6587\u4ef6\u5fc5\u987b\u5305\u542b\u540d\u79f0\u6e05\u6670\u7684include\u4fdd\u62a4\u7b26\uff0c\u4ece\u800c\u907f\u514d\u540c\u4e00\u5934\u6587\u4ef6\u88ab\u591a\u6b21include\u7684\u95ee\u9898\uff0c\u5e76\u9632\u6b62\u4e0e\u5176\u4ed6\u9879\u76ee\u7684\u5934\u6587\u4ef6\u53d1\u751f\u51b2\u7a81\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">ifndef<\/span>\u00a0MYPROJECT_MYCLASS_HPP<\/span>\n<span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">define<\/span>\u00a0MYPROJECT_MYCLASS_HPP<\/span>\n\n<span style=\"color: #c678dd; line-height: 26px;\">namespace<\/span>\u00a0MyProject\u00a0{\n\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">MyClass<\/span>\u00a0{<\/span>\n\u00a0\u00a0};\n}\n\n<span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">endif<\/span><\/span>\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6b64\u5916\u8fd8\u53ef\u4ee5\u8003\u8651\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">#pragma once<\/code>\u6307\u4ee4\uff0c\u8fd9\u662f\u8bb8\u591a\u7f16\u8bd1\u5668\u7684\u51c6\u6807\u51c6\uff0c\u5185\u5bb9\u7b80\u77ed\uff0c\u610f\u56fe\u660e\u786e\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4ee3\u7801\u5757\u5fc5\u987b\u5305\u542b<code>{}<\/code><\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u7701\u7565<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">{}<\/code>\u53ef\u80fd\u4f1a\u5bfc\u81f4\u4ee3\u7801\u8bed\u4e49\u9519\u8bef\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Bad\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0This\u00a0compiles\u00a0and\u00a0does\u00a0what\u00a0you\u00a0want,\u00a0but\u00a0can\u00a0lead\u00a0to\u00a0confusing<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0errors\u00a0if\u00a0modification\u00a0are\u00a0made\u00a0in\u00a0the\u00a0future\u00a0and\u00a0close\u00a0attention<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0is\u00a0not\u00a0paid.<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">for<\/span>\u00a0(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0i\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>;\u00a0i\u00a0&lt;\u00a0<span style=\"color: #d19a66; line-height: 26px;\">15<\/span>;\u00a0++i)\n\u00a0\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">std<\/span>::<span style=\"color: #e6c07b; line-height: 26px;\">cout<\/span>\u00a0&lt;&lt;\u00a0i\u00a0&lt;&lt;\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">std<\/span>::<span style=\"color: #e6c07b; line-height: 26px;\">endl<\/span>;\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Bad\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0The\u00a0cout\u00a0is\u00a0not\u00a0part\u00a0of\u00a0the\u00a0loop\u00a0in\u00a0this\u00a0case\u00a0even\u00a0though\u00a0it\u00a0appears\u00a0to\u00a0be.<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0sum\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>;\n<span style=\"color: #c678dd; line-height: 26px;\">for<\/span>\u00a0(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0i\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>;\u00a0i\u00a0&lt;\u00a0<span style=\"color: #d19a66; line-height: 26px;\">15<\/span>;\u00a0++i)\n\u00a0\u00a0++sum;\n\u00a0\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">std<\/span>::<span style=\"color: #e6c07b; line-height: 26px;\">cout<\/span>\u00a0&lt;&lt;\u00a0i\u00a0&lt;&lt;\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">std<\/span>::<span style=\"color: #e6c07b; line-height: 26px;\">endl<\/span>;\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Good\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0It's\u00a0clear\u00a0which\u00a0statements\u00a0are\u00a0part\u00a0of\u00a0the\u00a0loop\u00a0(or\u00a0if\u00a0block,\u00a0or\u00a0whatever).<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0sum\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>;\n<span style=\"color: #c678dd; line-height: 26px;\">for<\/span>\u00a0(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0i\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>;\u00a0i\u00a0&lt;\u00a0<span style=\"color: #d19a66; line-height: 26px;\">15<\/span>;\u00a0++i)\u00a0{\n\u00a0\u00a0++sum;\n\u00a0\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">std<\/span>::<span style=\"color: #e6c07b; line-height: 26px;\">cout<\/span>\u00a0&lt;&lt;\u00a0i\u00a0&lt;&lt;\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">std<\/span>::<span style=\"color: #e6c07b; line-height: 26px;\">endl<\/span>;\n}\n<\/code><\/pre>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4fdd\u6301\u6bcf\u884c\u4ee3\u7801\u957f\u5ea6\u5408\u7406<\/h4>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Bad\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0hard\u00a0to\u00a0follow<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(x\u00a0&amp;&amp;\u00a0y\u00a0&amp;&amp;\u00a0myFunctionThatReturnsBool()\u00a0&amp;&amp;\u00a0caseNumber3\u00a0&amp;&amp;\u00a0(<span style=\"color: #d19a66; line-height: 26px;\">15<\/span>\u00a0&gt;\u00a0<span style=\"color: #d19a66; line-height: 26px;\">12<\/span>\u00a0||\u00a0<span style=\"color: #d19a66; line-height: 26px;\">2<\/span>\u00a0&lt;\u00a0<span style=\"color: #d19a66; line-height: 26px;\">3<\/span>))\u00a0{\n}\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Good\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Logical\u00a0grouping,\u00a0easier\u00a0to\u00a0read<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0(x\u00a0&amp;&amp;\u00a0y\u00a0&amp;&amp;\u00a0myFunctionThatReturnsBool()\n\u00a0\u00a0\u00a0\u00a0&amp;&amp;\u00a0caseNumber3\n\u00a0\u00a0\u00a0\u00a0&amp;&amp;\u00a0(<span style=\"color: #d19a66; line-height: 26px;\">15<\/span>\u00a0&gt;\u00a0<span style=\"color: #d19a66; line-height: 26px;\">12<\/span>\u00a0||\u00a0<span style=\"color: #d19a66; line-height: 26px;\">2<\/span>\u00a0&lt;\u00a0<span style=\"color: #d19a66; line-height: 26px;\">3<\/span>))\u00a0{\n}\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8bb8\u591a\u9879\u76ee\u548c\u7f16\u7801\u6807\u51c6\u90fd\u5bf9\u6b64\u5236\u5b9a\u4e86\u8f6f\u89c4\u5219\uff0c\u5373\u6bcf\u884c\u5b57\u7b26\u5e94\u8be5\u5c11\u4e8e80\u6216100\u4e2a\uff0c\u8fd9\u6837\u7684\u4ee3\u7801\u901a\u5e38\u66f4\u5bb9\u6613\u9605\u8bfb\uff0c\u6b64\u5916\u8fd8\u53ef\u4ee5\u628a\u4e24\u4e2a\u6587\u4ef6\u5e76\u6392\u663e\u793a\u5728\u4e00\u4e2a\u5c4f\u5e55\u4e0a\uff0c\u4e0d\u7528\u5c0f\u5b57\u4f53\u4e5f\u80fd\u770b\u5230\u5168\u90e8\u4ee3\u7801\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4f7f\u7528<code>\"\"<\/code>\u8868\u793ainclude\u672c\u5730\u6587\u4ef6<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">&#8230;<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">&lt;&gt;<\/code>\u8868\u793a<span style=\"color: #1e6bb8; font-weight: bold;\">include\u7cfb\u7edf\u6587\u4ef6<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[11]<\/sup>\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Bad\u00a0Idea.\u00a0Requires\u00a0extra\u00a0-I\u00a0directives\u00a0to\u00a0the\u00a0compiler<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0and\u00a0goes\u00a0against\u00a0standards.<\/span>\n<span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">include<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">&lt;string&gt;<\/span><\/span>\n<span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">include<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">&lt;includes\/MyHeader.hpp&gt;<\/span><\/span>\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Worse\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Requires\u00a0potentially\u00a0even\u00a0more\u00a0specific\u00a0-I\u00a0directives\u00a0and<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0makes\u00a0code\u00a0more\u00a0difficult\u00a0to\u00a0package\u00a0and\u00a0distribute.<\/span>\n<span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">include<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">&lt;string&gt;<\/span><\/span>\n<span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">include<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">&lt;MyHeader.hpp&gt;<\/span><\/span>\n\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Good\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Requires\u00a0no\u00a0extra\u00a0params\u00a0and\u00a0notifies\u00a0the\u00a0user\u00a0that\u00a0the\u00a0file<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0is\u00a0a\u00a0local\u00a0file.<\/span>\n<span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">include<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">&lt;string&gt;<\/span><\/span>\n<span style=\"color: #61aeee; line-height: 26px;\">#<span style=\"line-height: 26px;\">include<\/span>\u00a0<span style=\"color: #98c379; line-height: 26px;\">\"MyHeader.hpp\"<\/span><\/span>\n<\/code><\/pre>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u521d\u59cb\u5316\u6210\u5458\u53d8\u91cf<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">&#8230;\u4f7f\u7528\u6210\u5458\u521d\u59cb\u5316\u5217\u8868\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5bf9\u4e8ePOD\u7c7b\u578b\uff0c\u521d\u59cb\u5316\u5217\u8868\u7684\u6027\u80fd\u4e0e\u624b\u52a8\u521d\u59cb\u5316\u76f8\u540c\uff0c\u4f46\u5bf9\u4e8e\u5176\u4ed6\u7c7b\u578b\uff0c\u6709\u660e\u663e\u7684\u6027\u80fd\u63d0\u5347\uff0c\u89c1\u4e0b\u6587\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Bad\u00a0Idea<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">MyClass<\/span>\n{<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>:\n\u00a0\u00a0MyClass(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0t_value)\n\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0m_value\u00a0=\u00a0t_value;\n\u00a0\u00a0}\n\n<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0m_value;\n};\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Bad\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0This\u00a0leads\u00a0to\u00a0an\u00a0additional\u00a0constructor\u00a0call\u00a0for\u00a0m_myOtherClass<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0before\u00a0the\u00a0assignment.<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">MyClass<\/span>\n{<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>:\n\u00a0\u00a0MyClass(MyOtherClass\u00a0t_myOtherClass)\n\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0m_myOtherClass\u00a0=\u00a0t_myOtherClass;\n\u00a0\u00a0}\n\n<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0MyOtherClass\u00a0m_myOtherClass;\n};\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Good\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0There\u00a0is\u00a0no\u00a0performance\u00a0gain\u00a0here\u00a0but\u00a0the\u00a0code\u00a0is\u00a0cleaner.<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">MyClass<\/span>\n{<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>:\n\u00a0\u00a0MyClass(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0t_value)\n\u00a0\u00a0\u00a0\u00a0:\u00a0m_value(t_value)\n\u00a0\u00a0{\n\u00a0\u00a0}\n\n<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0m_value;\n};\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Good\u00a0Idea<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0The\u00a0default\u00a0constructor\u00a0for\u00a0m_myOtherClass\u00a0is\u00a0never\u00a0called\u00a0here,\u00a0so\u00a0<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0there\u00a0is\u00a0a\u00a0performance\u00a0gain\u00a0if\u00a0MyOtherClass\u00a0is\u00a0not\u00a0is_trivially_default_constructible.\u00a0<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">MyClass<\/span>\n{<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>:\n\u00a0\u00a0MyClass(MyOtherClass\u00a0t_myOtherClass)\n\u00a0\u00a0\u00a0\u00a0:\u00a0m_myOtherClass(t_myOtherClass)\n\u00a0\u00a0{\n\u00a0\u00a0}\n\n<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0MyOtherClass\u00a0m_myOtherClass;\n};\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5728C++11\u4e2d\uff0c\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6210\u5458\u521d\u59cb\u5316\u9ed8\u8ba4\u503c(\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">=<\/code>\u6216\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">{}<\/code>)\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4f7f\u7528<code>=<\/code>\u8bbe\u7f6e\u9ed8\u8ba4\u503c<\/h4>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0...\u00a0\/\/<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0m_value\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>;\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0allowed<\/span>\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">unsigned<\/span>\u00a0m_value_2\u00a0=\u00a0<span style=\"color: #d19a66; line-height: 26px;\">-1<\/span>;\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0narrowing\u00a0from\u00a0signed\u00a0to\u00a0unsigned\u00a0allowed<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0...\u00a0\/\/<\/span>\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4e0d\u4f1a\u51fa\u73b0\u6784\u9020\u51fd\u6570\u201c\u5fd8\u8bb0\u201d\u521d\u59cb\u5316\u6210\u5458\u5bf9\u8c61\u7684\u60c5\u51b5\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u7528\u5927\u62ec\u53f7\u521d\u59cb\u5316\u9ed8\u8ba4\u503c<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u7528\u5927\u62ec\u53f7\u521d\u59cb\u5316\u4e0d\u5141\u8bb8\u5728\u7f16\u8bd1\u65f6\u622a\u65ad\u6570\u636e\u957f\u5ea6\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0Best\u00a0Idea<\/span>\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0...\u00a0\/\/<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0m_value{\u00a0<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>\u00a0};\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0allowed<\/span>\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">unsigned<\/span>\u00a0m_value_2\u00a0{\u00a0<span style=\"color: #d19a66; line-height: 26px;\">-1<\/span>\u00a0};\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0narrowing\u00a0from\u00a0signed\u00a0to\u00a0unsigned\u00a0not\u00a0allowed,\u00a0leads\u00a0to\u00a0a\u00a0compile\u00a0time\u00a0error<\/span>\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0...\u00a0\/\/<\/span>\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u9664\u975e\u6709\u660e\u786e\u7684\u7406\u7531\uff0c\u5426\u5219\u4f18\u5148\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">{}<\/code>\u521d\u59cb\u5316\uff0c\u800c\u4e0d\u662f<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">=<\/code>\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5fd8\u8bb0\u521d\u59cb\u5316\u6210\u5458\u4f1a\u5bfc\u81f4\u672a\u5b9a\u4e49\u884c\u4e3a\u9519\u8bef\uff0c\u800c\u8fd9\u4e9b\u9519\u8bef\u901a\u5e38\u5f88\u96be\u53d1\u73b0\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5982\u679c\u6210\u5458\u53d8\u91cf\u5728\u521d\u59cb\u5316\u540e\u4e0d\u4f1a\u66f4\u6539\uff0c\u5219\u5c06\u5176\u6807\u8bb0\u4e3a<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">const<\/code>\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">class<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">MyClass<\/span>\n{<\/span>\n<span style=\"color: #c678dd; line-height: 26px;\">public<\/span>:\n\u00a0\u00a0MyClass(<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0t_value)\n\u00a0\u00a0\u00a0\u00a0:\u00a0m_value{t_value}\n\u00a0\u00a0{\n\u00a0\u00a0}\n\n<span style=\"color: #c678dd; line-height: 26px;\">private<\/span>:\n\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">const<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>\u00a0m_value{<span style=\"color: #d19a66; line-height: 26px;\">0<\/span>};\n};\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u7531\u4e8e\u4e0d\u80fd\u7ed9const\u6210\u5458\u53d8\u91cf\u8d4b\u503c\uff0c\u62f7\u8d1d\u8d4b\u503c\u64cd\u4f5c\u53ef\u80fd\u5bf9\u8fd9\u6837\u7684\u7c7b\u6ca1\u6709\u610f\u4e49\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u603b\u662f\u4f7f\u7528\u547d\u540d\u7a7a\u95f4<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u51e0\u4e4e\u6ca1\u6709\u7406\u7531\u9700\u8981\u5168\u5c40\u547d\u540d\u7a7a\u95f4\u4e2d\u58f0\u660e\u6807\u8bc6\u7b26\u3002\u76f8\u53cd\uff0c\u51fd\u6570\u548c\u7c7b\u5e94\u8be5\u5b58\u5728\u4e8e\u9002\u5f53\u547d\u540d\u7684\u547d\u540d\u7a7a\u95f4\u4e2d\uff0c\u6216\u8005\u5b58\u5728\u4e8e\u547d\u540d\u7a7a\u95f4\u91cc\u7684\u7c7b\u4e2d\u3002\u653e\u5728\u5168\u5c40\u547d\u540d\u7a7a\u95f4\u4e2d\u7684\u6807\u8bc6\u7b26\u6709\u53ef\u80fd\u4e0e\u6765\u81ea\u5176\u4ed6\u5e93(\u4e3b\u8981\u662f\u6ca1\u6709\u547d\u540d\u7a7a\u95f4\u7684C\u5e93)\u7684\u6807\u8bc6\u7b26\u53d1\u751f\u51b2\u7a81\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4e3a\u6807\u51c6\u5e93\u7279\u6027\u4f7f\u7528\u6b63\u786e\u7684\u6574\u6570\u7c7b\u578b<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6807\u51c6\u5e93\u901a\u5e38\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">std::size_t<\/code>\u6765\u5904\u7406\u4e0e\u5c3a\u5bf8\u76f8\u5173\u7684\u5185\u5bb9\uff0c<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">size_t<\/code>\u7684\u5927\u5c0f\u7531\u5b9e\u73b0\u5b9a\u4e49\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e00\u822c\u6765\u8bf4\uff0c\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">auto<\/code>\u53ef\u4ee5\u907f\u514d\u5927\u90e8\u5206\u95ee\u9898\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8bf7\u786e\u4fdd\u4f7f\u7528\u6b63\u786e\u7684\u6574\u6570\u7c7b\u578b\uff0c\u5e76\u4e0eC++\u6807\u51c6\u5e93\u4fdd\u6301\u4e00\u81f4\uff0c\u5426\u5219\u6709\u53ef\u80fd\u5728\u5f53\u524d\u4f7f\u7528\u7684\u5e73\u53f0\u4e0a\u4e0d\u4f1a\u53d1\u51fa\u8b66\u544a\uff0c\u4f46\u5982\u679c\u5207\u6362\u5230\u5176\u4ed6\u5e73\u53f0\uff0c\u53ef\u80fd\u4f1a\u53d1\u51fa\u8b66\u544a\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\"><em>\u6ce8\u610f\uff0c\u5728\u5bf9\u65e0\u7b26\u53f7\u6570\u6267\u884c\u67d0\u4e9b\u64cd\u4f5c\u65f6\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6574\u6570\u4e0b\u6ea2\u3002\u4f8b\u5982:<\/em><\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #e6c07b; line-height: 26px;\">std<\/span>::<span style=\"color: #e6c07b; line-height: 26px;\">vector<\/span>&lt;<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>&gt;\u00a0v1{<span style=\"color: #d19a66; line-height: 26px;\">2<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">3<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">4<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">5<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">6<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">7<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">8<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">9<\/span>};\n<span style=\"color: #e6c07b; line-height: 26px;\">std<\/span>::<span style=\"color: #e6c07b; line-height: 26px;\">vector<\/span>&lt;<span style=\"color: #c678dd; line-height: 26px;\">int<\/span>&gt;\u00a0v2{<span style=\"color: #d19a66; line-height: 26px;\">9<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">8<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">7<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">6<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">5<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">4<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">3<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">2<\/span>,<span style=\"color: #d19a66; line-height: 26px;\">1<\/span>};\n<span style=\"color: #c678dd; line-height: 26px;\">const<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">auto<\/span>\u00a0s1\u00a0=\u00a0v1.size();\n<span style=\"color: #c678dd; line-height: 26px;\">const<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">auto<\/span>\u00a0s2\u00a0=\u00a0v2.size();\n<span style=\"color: #c678dd; line-height: 26px;\">const<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">auto<\/span>\u00a0diff\u00a0=\u00a0s1\u00a0-\u00a0s2;\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0diff\u00a0underflows\u00a0to\u00a0a\u00a0very\u00a0large\u00a0number<\/span>\n<\/code><\/pre>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4f7f\u7528<code>.hpp<\/code>\u548c<code>.cpp<\/code>\u4f5c\u4e3a\u6587\u4ef6\u6269\u5c55\u540d<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5f52\u6839\u7ed3\u5e95\uff0c\u8fd9\u662f\u4e2a\u4eba\u559c\u597d\u95ee\u9898\uff0c\u4f46\u662f.hpp\u548c.cpp\u5df2\u88ab\u5404\u79cd\u7f16\u8f91\u5668\u548c\u5de5\u5177\u5e7f\u6cdb\u8ba4\u53ef\u3002\u56e0\u6b64\uff0c\u8fd9\u662f\u4e00\u4e2a\u52a1\u5b9e\u7684\u9009\u62e9\u3002\u5177\u4f53\u6765\u8bf4\uff0cVisual Studio\u53ea\u81ea\u52a8\u8bc6\u522b.cpp\u548c.cxx\u4e3aC++\u6587\u4ef6\uff0c\u800cVim\u4e0d\u4e00\u5b9a\u4f1a\u628a.cc\u8bc6\u522b\u4e3aC++\u6587\u4ef6\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u67d0\u4e2a\u7279\u522b\u5927\u7684\u9879\u76ee(<span style=\"color: #1e6bb8; font-weight: bold;\">OpenStudio<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[12]<\/sup>)\u4f7f\u7528.hpp\u548c.cpp\u8868\u793a\u7528\u6237\u751f\u6210\u7684\u6587\u4ef6\uff0c\u800c\u4f7f\u7528.hxx\u548c.cxx\u8868\u793a\u5de5\u5177\u751f\u6210\u7684\u6587\u4ef6\u3002\u4e24\u8005\u90fd\u80fd\u88ab\u5f88\u597d\u7684\u8bc6\u522b\uff0c\u5e76\u4e14\u533a\u5206\u5f00\u6765\u6709\u5f88\u5927\u7684\u5e2e\u52a9\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4e0d\u8981\u6df7\u7528tab\u548c\u7a7a\u683c<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u67d0\u4e9b\u7f16\u8f91\u5668\u559c\u6b22\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f7f\u7528tab\u548c\u7a7a\u683c\u7684\u6df7\u5408\u7f29\u8fdb\uff0c\u8fd9\u4f7f\u5f97\u6ca1\u6709\u4f7f\u7528\u5b8c\u5168\u76f8\u540c\u7684tab\u7f29\u8fdb\u8bbe\u7f6e\u7684\u4eba\u5f88\u96be\u9605\u8bfb\u4ee3\u7801\u3002\u8bf7\u914d\u7f6e\u597d\u7f16\u8f91\u5668\uff0c\u786e\u4fdd\u4e0d\u4f1a\u53d1\u751f\u8fd9\u79cd\u60c5\u51b5\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4e0d\u8981\u5c06\u6709\u526f\u4f5c\u7528\u7684\u4ee3\u7801\u653e\u5728assert()\u4e2d<\/h4>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\">assert(registerSomeThing());\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0make\u00a0sure\u00a0that\u00a0registerSomeThing()\u00a0returns\u00a0true<\/span>\n<\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e0a\u8ff0\u4ee3\u7801\u5728debug\u6a21\u5f0f\u4e0b\u6784\u5efa\u65f6\u53ef\u4ee5\u6210\u529f\u8fd0\u884c\uff0c\u4f46\u5728\u8fdb\u884crelease\u6784\u5efa\u65f6\u4f1a\u88ab\u7f16\u8bd1\u5668\u5220\u9664\uff0c\u4ece\u800c\u9020\u6210debug\u548crelease\u6784\u5efa\u7684\u884c\u4e3a\u4e0d\u4e00\u81f4\uff0c\u539f\u56e0\u5728\u4e8e<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">assert()<\/code>\u662f\u4e00\u4e2a\u5b8f\uff0c\u5b83\u5728release\u6a21\u5f0f\u4e0b\u5c55\u5f00\u4e3a\u7a7a\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u4e0d\u8981\u5bb3\u6015\u6a21\u677f<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6a21\u677f\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u575a\u6301<span style=\"color: #1e6bb8; font-weight: bold;\">DRY\u539f\u5219<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[13]<\/sup>\u3002\u7531\u4e8e\u5b8f\u6709\u4e0d\u9075\u5b88\u547d\u540d\u7a7a\u95f4\u7b49\u95ee\u9898\uff0c\u56e0\u6b64\u80fd\u7528\u6a21\u677f\u7684\u5730\u65b9\u5c31\u4e0d\u8981\u7528\u5b8f\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u660e\u667a\u7684\u4f7f\u7528\u64cd\u4f5c\u7b26\u91cd\u8f7d<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8fd0\u7b97\u7b26\u91cd\u8f7d\u662f\u4e3a\u4e86\u652f\u6301\u8868\u8fbe\u6027\u8bed\u6cd5\u3002\u6bd4\u5982\u8ba9\u4e24\u4e2a\u5927\u6570\u76f8\u52a0\u770b\u8d77\u6765\u50cf<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">a + b<\/code>\uff0c\u800c\u4e0d\u662f<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">a.add(b)<\/code>\u3002\u53e6\u4e00\u4e2a\u5e38\u89c1\u7684\u4f8b\u5b50\u662f<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">std::string<\/code>\uff0c\u901a\u5e38\u4f7f\u7528<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">string1 + string2<\/code>\u8fde\u63a5\u4e24\u4e2a\u5b57\u7b26\u4e32\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4f46\u662f\uff0c\u4f7f\u7528\u8fc7\u591a\u6216\u9519\u8bef\u7684\u64cd\u4f5c\u7b26\u91cd\u8f7d\u5f88\u5bb9\u6613\u5199\u51fa\u53ef\u8bfb\u6027\u4e0d\u5f3a\u7684\u8868\u8fbe\u5f0f\u3002\u5728\u91cd\u8f7d\u64cd\u4f5c\u7b26\u65f6\uff0c\u8981\u9075\u5faa<span style=\"color: #1e6bb8; font-weight: bold;\">stackoverflow\u6587\u7ae0<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[14]<\/sup>\u4e2d\u63cf\u8ff0\u7684\u4e09\u6761\u57fa\u672c\u89c4\u5219\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5177\u4f53\u6765\u8bf4\uff0c\u8bb0\u4f4f\u4ee5\u4e0b\u51e0\u70b9:<\/p>\n<ul class=\"list-paddingleft-1\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; list-style-type: square;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5904\u7406\u8d44\u6e90\u65f6\u5fc5\u987b\u91cd\u8f7d<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">operator=()<\/code>\uff0c\u53c2\u89c1\u4e0b\u9762Rule of Zero\u7ae0\u8282\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5bf9\u4e8e\u6240\u6709\u5176\u4ed6\u64cd\u4f5c\u7b26\uff0c\u901a\u5e38\u53ea\u6709\u5728\u9700\u8981\u5728\u4e0a\u4e0b\u6587\u4e2d\u4f7f\u7528\u65f6\u624d\u91cd\u8f7d\u3002\u5178\u578b\u7684\u573a\u666f\u662f\u7528+\u8fde\u63a5\u4e8b\u7269\uff0c\u8d1f\u53f7\u53ef\u4ee5\u88ab\u8ba4\u4e3a\u662f\u201c\u771f\u201d\u6216\u201c\u5047\u201d\u7684\u8868\u8fbe\u5f0f\uff0c\u7b49\u7b49\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4e00\u5b9a\u8981\u6ce8\u610f<span style=\"color: #1e6bb8; font-weight: bold;\">\u64cd\u4f5c\u7b26\u4f18\u5148\u7ea7<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[15]<\/sup>\uff0c\u5c3d\u91cf\u907f\u514d\u4e0d\u76f4\u89c2\u7684\u7ed3\u6784\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u9664\u975e\u5b9e\u73b0\u6570\u5b57\u7c7b\u578b\u6216\u9075\u5faa\u7279\u5b9a\u57df\u4e2d\u53ef\u8bc6\u522b\u7684\u8bed\u6cd5\uff0c\u5426\u5219\u4e0d\u8981\u91cd\u8f7d~\u6216%\u8fd9\u6837\u7684\u5916\u90e8\u64cd\u4f5c\u7b26\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u6c38\u8fdc\u4e0d\u8981<span style=\"color: #1e6bb8; font-weight: bold;\">\u91cd\u8f7d&#8220;`operator,()&#8220;`<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[16]<\/sup>(\u9017\u53f7\u64cd\u4f5c\u7b26)\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5904\u7406\u6d41\u65f6\u4f7f\u7528\u975e\u6210\u5458\u51fd\u6570<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">operator&gt;&gt;()<\/code>\u548c<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">operator&lt;&lt;()<\/code>\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u91cd\u8f7d<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">operator&lt;&lt;(std::ostream &amp;\uff0c MyClass const &amp;)<\/code>\uff0c\u4ece\u800c\u5141\u8bb8\u5c06\u7c7b\u201c\u5199\u5165\u201d\u5230\u4e00\u4e2a\u6d41\u4e2d\uff0c\u4f8b\u5982<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">std::cout<\/code>\u6216<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">std::fstream<\/code>\u6216<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">std::stringstream<\/code>\uff0c\u540e\u8005\u901a\u5e38\u7528\u4e8e\u521b\u5efa\u503c\u7684\u5b57\u7b26\u4e32\u8868\u793a\u3002<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u8fd9\u7bc7\u6587\u7ae0\u63cf\u8ff0\u4e86\u66f4\u591a\u9700\u8981\u91cd\u8f7d\u7684\u5e38\u89c1\u64cd\u4f5c\u7b26: <span style=\"color: #1e6bb8; font-weight: bold;\">What are the basic rules and idioms for operator overloading?<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[17]<\/sup>\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u66f4\u591a\u5173\u4e8e\u81ea\u5b9a\u4e49\u64cd\u4f5c\u7b26\u5b9e\u73b0\u7ec6\u8282\u7684\u6280\u5de7\u53ef\u4ee5\u53c2\u8003: <span style=\"color: #1e6bb8; font-weight: bold;\">C++ Operator Overloading Guidelines<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[18]<\/sup>\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u907f\u514d\u9690\u5f0f\u8f6c\u6362<\/h4>\n<h5 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold;\">\u5355\u53c2\u6570\u6784\u9020\u51fd\u6570<\/h5>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u53ef\u4ee5\u5728\u7f16\u8bd1\u65f6\u5e94\u7528\u5355\u53c2\u6570\u6784\u9020\u51fd\u6570\u5728\u7c7b\u578b\u4e4b\u95f4\u81ea\u52a8\u8f6c\u6362\uff0c\u6bd4\u5982\u50cf<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">std::string(const char *)<\/code>\uff0c\u8fd9\u6837\u7684\u8f6c\u6362\u5f88\u65b9\u4fbf\uff0c\u4f46\u901a\u5e38\u5e94\u8be5\u907f\u514d\uff0c\u56e0\u4e3a\u53ef\u80fd\u4f1a\u589e\u52a0\u989d\u5916\u7684\u8fd0\u884c\u65f6\u5f00\u9500\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u76f8\u53cd\uff0c\u53ef\u4ee5\u5c06\u5355\u53c2\u6570\u6784\u9020\u51fd\u6570\u6807\u8bb0\u4e3a<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">explicit<\/code>\uff0c\u4ece\u800c\u8981\u6c42\u663e\u5f0f\u8c03\u7528\u3002<\/p>\n<h5 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold;\">\u8f6c\u6362\u64cd\u4f5c\u7b26<\/h5>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e0e\u5355\u53c2\u6570\u6784\u9020\u51fd\u6570\u7c7b\u4f3c\uff0c\u7f16\u8bd1\u5668\u53ef\u4ee5\u8c03\u7528\u8f6c\u6362\u64cd\u4f5c\u7b26\uff0c\u540c\u6837\u4e5f\u4f1a\u5f15\u5165\u989d\u5916\u5f00\u9500\uff0c\u4e5f\u5e94\u8be5\u88ab\u6807\u8bb0\u4e3a<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">explicit<\/code>\u3002<\/p>\n<pre style=\"box-shadow: rgba(170, 170, 170, 0.48) 0px 0px 6px 0px; max-width: 100%; border-radius: 4px; margin-top: 10px; margin-right: auto; margin-left: auto;\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/bad\u00a0idea<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">struct<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">S<\/span>\u00a0{<\/span>\n\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">operator<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">int<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<\/span>{\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">2<\/span>;\n\u00a0\u00a0}\n};\n\n<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/good\u00a0idea<\/span>\n<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">struct<\/span>\u00a0<span style=\"color: #e6c07b; line-height: 26px;\">S<\/span>\u00a0{<\/span>\n\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">explicit<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">operator<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">int<\/span><span style=\"line-height: 26px;\">()<\/span>\u00a0<\/span>{\n\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #d19a66; line-height: 26px;\">2<\/span>;\n\u00a0\u00a0}\n};\n<\/code><\/pre>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">\u8003\u8651Rule of Zero<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">Rule of Zero\u89c4\u5b9a\uff0c\u9664\u975e\u6240\u6784\u9020\u7684\u7c7b\u5177\u6709\u67d0\u79cd\u65b0\u7684\u6240\u6709\u6743\u5f62\u5f0f\uff0c\u5426\u5219\u4e0d\u63d0\u4f9b\u7f16\u8bd1\u5668\u53ef\u4ee5\u63d0\u4f9b\u7684\u4efb\u4f55\u51fd\u6570(\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u3001\u62f7\u8d1d\u8d4b\u503c\u64cd\u4f5c\u7b26\u3001\u79fb\u52a8\u6784\u9020\u51fd\u6570\u3001\u79fb\u52a8\u8d4b\u503c\u64cd\u4f5c\u7b26\u3001\u6790\u6784\u51fd\u6570)\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u76ee\u6807\u662f\u8ba9\u7f16\u8bd1\u5668\u63d0\u4f9b\u5728\u6dfb\u52a0\u66f4\u591a\u6210\u5458\u53d8\u91cf\u65f6\u81ea\u52a8\u7ef4\u62a4\u7684\u6700\u4f73\u7248\u672c\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8fd9\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u4e86\u8fd9\u4e00\u539f\u5219\u7684\u80cc\u666f\uff0c\u5e76\u89e3\u91ca\u4e86\u51e0\u4e4e\u53ef\u4ee5\u8986\u76d6\u6240\u6709\u60c5\u51b5\u7684\u5b9e\u73b0\u6280\u672f: <span style=\"color: #1e6bb8; font-weight: bold;\">C++&#8217;s Rule of Zero<\/span><sup style=\"line-height: 0; color: #1e6bb8; font-weight: bold;\">[19]<\/sup>\u3002<\/p>\n<blockquote style=\"border-top: none; border-bottom: none; font-size: 0.9em; overflow: auto; color: #6a737d; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; border-left-color: rgba(0, 0, 0, 0.65); border-right: 1px solid rgba(0, 0, 0, 0.65); background: #f9f9f9;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; font-size: 14px; color: black; line-height: 26px;\">\u5fae\u4fe1\u516c\u4f17\u53f7\uff1aDeepNoMind<\/p>\n<\/blockquote>\n<h3 style=\"font-weight: bold; font-size: 14px; color: #888888; border-top: 1px solid #eeeeee; padding-top: 30px; padding-bottom: 10px; width: 100%;\"><span style=\"display: block;\">\u53c2\u8003\u8d44\u6599<\/span><\/h3>\n<section style=\"border-left: 5px solid #eee; padding-left: 10px;\"><span style=\"display: flex;\"><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[1]<\/span><\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">C++ Best Practises: <em>https:\/\/lefticus.gitbooks.io\/cpp-best-practices\/content\/<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[2]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">Microsoft C\/C++ extension for VS Code: <em>https:\/\/github.com\/Microsoft\/vscode-cpptools<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[3]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">ClangFormat: <em>https:\/\/marketplace.visualstudio.com\/items?itemName=LLVMExtensions.ClangFormat#review-details<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[4]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">Using Clang-Format: <em>https:\/\/www.jetbrains.com\/help\/resharper\/2017.2\/Using_Clang_Format.html<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[5]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">Format your C family code: <em>https:\/\/github.com\/rhysd\/vim-clang-format<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[6]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">vim-autoformat: <em>https:\/\/github.com\/chiel92\/vim-autoformat<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[7]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">ClangFormat-Xcode: <em>https:\/\/github.com\/travisjeffery\/ClangFormat-Xcode<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[8]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">Boost: <em>http:\/\/www.boost.org\/<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[9]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">issue #11: <em>https:\/\/github.com\/lefticus\/cppbestpractices\/issues\/11<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[10]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">What are the rules about using an underscore in a C++ identifier?: <em>https:\/\/stackoverflow.com\/questions\/228783\/what-are-the-rules-about-using-an-underscore-in-a-c-identifier<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[11]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">include\u7cfb\u7edf\u6587\u4ef6: <em>http:\/\/blog2.emptycrate.com\/content\/when-use-include-verses-include<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[12]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">OpenStudio: <em>https:\/\/github.com\/NREL\/OpenStudio<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[13]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">DRY\u539f\u5219: <em>http:\/\/en.wikipedia.org\/wiki\/Don%27t_repeat_yourself<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[14]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">stackoverflow\u6587\u7ae0: <em>http:\/\/stackoverflow.com\/questions\/4421706\/operator-overloading\/4421708#4421708<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[15]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">\u64cd\u4f5c\u7b26\u4f18\u5148\u7ea7: <em>http:\/\/en.cppreference.com\/w\/cpp\/language\/operator_precedence<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[16]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">\u91cd\u8f7d<code style=\"overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ff6441;\">operator,()<\/code>: <em>http:\/\/stackoverflow.com\/questions\/5602112\/when-to-overload-the-comma-operator?answertab=votes#tab-top<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[17]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">What are the basic rules and idioms for operator overloading?: <em>https:\/\/stackoverflow.com\/questions\/4421706\/what-are-the-basic-rules-and-idioms-for-operator-overloading?answertab=votes#tab-top<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[18]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">C++ Operator Overloading Guidelines: <em>http:\/\/courses.cms.caltech.edu\/cs11\/material\/cpp\/donnie\/cpp-ops.html<\/em><\/p>\n<p><span style=\"display: flex;\"><span style=\"display: inline; width: 10%; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; opacity: 0.6; line-height: 26px; font-family: ptima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; color: #999999;\">[19]<\/span><\/span><\/p>\n<p style=\"display: inline; width: 90%; line-height: 26px; word-break: break-all; color: #999999;\">C++&#8217;s Rule of Zero: <em>http:\/\/www.nirfriedman.com\/2015\/06\/27\/cpp-rule-of-zero<\/em><\/p>\n<\/section>\n<p>\u8f6c\u81ea\uff1ahttps:\/\/mp.weixin.qq.com\/s\/aFY3cBIsucd5J0034pzRAg<\/section>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7cfb\u5217\u662f\u5f00\u6e90\u4e66C++ Best Practises[1]\u7684\u4e2d\u6587\u7248\uff0c\u5168\u4e66\u4ece\u5de5\u5177\u3001\u4ee3\u7801\u98ce\u683c\u3001\u5b89\u5168\u6027\u3001\u53ef\u7ef4\u62a4\u6027\u3001\u53ef\u79fb &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=111711\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cC++\u6700\u4f73\u5b9e\u8df5 | 2. \u4ee3\u7801\u98ce\u683c\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/111711"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=111711"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/111711\/revisions"}],"predecessor-version":[{"id":111714,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/111711\/revisions\/111714"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=111711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=111711"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=111711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}