{"id":156524,"date":"2020-09-17T20:18:19","date_gmt":"2020-09-17T12:18:19","guid":{"rendered":"http:\/\/4563.org\/?p=156524"},"modified":"2020-09-17T20:18:19","modified_gmt":"2020-09-17T12:18:19","slug":"%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3-c%e4%b8%a4%e4%b8%aa%e7%b1%bb%e9%9c%80%e8%a6%81%e4%ba%92%e7%9b%b8%e5%bc%95%e7%94%a8%e7%9a%84%e5%9c%ba%e6%99%af%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=156524","title":{"rendered":"\u5982\u4f55\u89e3\u51b3 C++\u4e24\u4e2a\u7c7b\u9700\u8981\u4e92\u76f8\u5f15\u7528\u7684\u573a\u666f\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5982\u4f55\u89e3\u51b3 C++\u4e24\u4e2a\u7c7b\u9700\u8981\u4e92\u76f8\u5f15\u7528\u7684\u573a\u666f\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 1YsX1 <\/span>  <span><i><\/i> 7<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e24\u4e2a\u5934\u6587\u4ef6\u5982\u679c\u9700\u8981\u76f8\u4e92\u5f15\u7528\u7684\u8bdd\uff0c\u7f16\u8bd1\u7684\u8fc7\u7a0b\u4e2d\u5b58\u5728\u4e00\u4e9b\u95ee\u9898\u3002 \u7136\u540e google \u6709\u4e00\u4e9b\u7b80\u5355\u7684\u65b9\u6cd5\u6bd4\u5982\u4e0d\u5f15\u7528\u53ea\u58f0\u660e\uff0c\u4e5f\u662f\u53ef\u4ee5\u8fc7\u7f16\u8bd1\u7684\uff0c\u4f46\u662f\u6d89\u53ca\u5230\u6210\u5458\u51fd\u6570\u8c03\u7528\u7684\u65f6\u5019\u6709\u65f6\u8fd8\u662f\u4f1a\u6709\u95ee\u9898\u3002 \u6211\u89c9\u5f97\u8fd9\u662f\u4e00\u79cd\u6cbb\u6807\u4e0d\u6cbb\u672c\u7684\u65b9\u6cd5\uff0c\u6240\u4ee5\u60f3\u77e5\u9053\u6bd4\u5982\u5bf9\u4e8e\u6211\u4e0b\u9762\u7684\u8fd9\u4e2a\u573a\u666f\uff0c\u80fd\u4e0d\u80fd\u4ece\u8bbe\u8ba1\u6a21\u5f0f\u7684\u89d2\u5ea6\uff0c\u6709\u66f4\u597d\u7684\u8bbe\u8ba1\u65b9\u6cd5\u5417\uff1f<\/p>\n<p>\u6bd4\u5982\u73b0\u5728\u9700\u8981\u7528 Tree \u7ed3\u6784\u6765\u5b58\u50a8 Frame \u8282\u70b9\uff0c\u540c\u65f6 Frame \u8282\u70b9\u5185\u9700\u8981\u4e86\u89e3\u5f53\u524d\u6811\u7ed3\u6784\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u6211\u5728\u6811\u7ed3\u6784\u5185\u5b9a\u4e49\u4e86\u6bcf\u4e00\u4e2a Frame \u8282\u70b9\u7684\u957f\u5ea6\uff0c\u6240\u4ee5\u6211\u9700\u8981 Tree-&gt;GetLength(Frame*) \u6765\u83b7\u53d6\u3002\u6240\u4ee5\u8fd9\u4e24\u4e2a class \u6211\u8ba4\u4e3a\u9700\u8981\u5305\u542b\u8fd9\u51e0\u4e2a\u51fd\u6570\u7684<\/p>\n<pre><code>class Frame{  int Id;     char * data;     Tree* MyTree;     Frame(MyTree* T){      data = new char(T-&gt;GetLength(Id));     } }  class Tree{  unordered_map&lt;int,int&gt; FrameSize;     vector&lt;Frame*&gt; Nodes;     Tree(){      Nodes.push_back(new Frame(this));         ...         Nodes.push_back(new Frame(this));     }  int GetLength (int Id){   return FrameSize[Id];  } } <\/code><\/pre>\n<p>\u4e0a\u9762\u8fd9\u6bb5\u4ee3\u7801\u53ef\u80fd\u6709\u4e00\u4e9b\u8bed\u6cd5\u4e0a\u662f\u4e0d\u901a\u7684\uff0c\u4f46\u662f\u6211\u60f3\u5b9e\u73b0\u7684\u57fa\u672c\u51fd\u6570\u7684\u601d\u8def\u4f53\u73b0\u51fa\u6765\u4e86\u3002\u6211\u89c9\u5f97\u8fd9\u79cd\u8bbe\u8ba1\u6a21\u5f0f\u5b58\u5728\u95ee\u9898\uff0c\u8bf7\u95ee\u6709\u6ca1\u6709\u66f4\u597d\u7684\u6a21\u5f0f\u6216\u8005\u8bf4\u5bf9\u8fd9\u4e2a\u95ee\u9898\u7684\u89e3\u51b3\u529e\u6cd5\uff1f\u8c22\u8c22\uff01<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3259201\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yuzhibopro <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. \u53cb\u5143\u7c7b 2.\u4e92\u4f20\u6307\u9488\uff0c\u5171\u6709\u51fd\u6570\u8bbf\u95ee\uff0c\u4e0d\u77e5\u9053\u80fd\u4e0d\u80fd\u89e3\u51b3\u4f60\u8bf4\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3259202\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hazardous <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u7684\u9700\u6c42\u662f\u51fd\u6570\u5b9e\u73b0\u5fc5\u987b\u5199\u5728\u5934\u6587\u4ef6\u91cc\u4e48\uff1f\u5982\u679c\u4e0d\u7528\u90a3\u5c31\u628a\u51fd\u6570\u5b9e\u73b0\u632a\u5230 cpp \u91cc\u7136\u540e\u5728\u53cc\u65b9\u5934\u6587\u4ef6\u91cc\u90fd\u524d\u7f6e\u58f0\u660e\u5bf9\u65b9\u4e0d\u5c31\u53ef\u4ee5\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3259203\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 1YsX1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yuzhibopro \u8c22\u8c22\uff0c\u4e92\u4f20\u6307\u9488\u8fd8\u662f\u9700\u8981\u5f15\u7528\u5934\u6587\u4ef6\u3002\u6211\u5c1d\u8bd5\u4e00\u4e0b\u53cb\u5143\u7c7b\u7684\u65b9\u6cd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3259204\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 1YsX1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hazardous \u8c22\u8c22~\u6211\u8ba4\u4e3a\u662f\u7684\uff0c\u56e0\u4e3a\u8fd9\u4e24\u4e2a\u7c7b\u4e5f\u4e0d\u53ea\u662f\u4e92\u76f8\u7528\u4e00\u4e0b\u5c31\u7ed3\u675f\u4e86\uff0c\u8fd8\u5f97\u5bf9\u5916\u63d0\u4f9b\u63a5\u53e3\u7684\u3002\u6240\u4ee5\u8981\u5199\u5934\u6587\u4ef6\u4ee5\u65b9\u4fbf\u53e6\u5916\u7684\u7c7b\u518d\u6765\u4f7f\u7528\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3259205\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wutiantong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e24\u4e2a\u73a9\u610f\u672c\u6765\u5c31\u5e94\u8be5\u653e\u5728\u4e00\u8d77\uff0c\u540c\u4e00\u4e2a\u5934\u6587\u4ef6\u91cc\uff0cFrame \u5f3a\u70c8\u503e\u5411\u4e8e\u505a\u6210 Tree \u7684 inner class                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3259206\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cjw6 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             class A;<br \/>calss B{<br \/>&#8230;&#8230;&#8230;&#8230;..<br \/>private:<br \/>A a;<br \/>};<br \/>class A{<br \/>&#8230;&#8230;&#8230;.<br \/>}<\/p>\n<p>\u524d\u5411\u58f0\u660e\u6ce8\u610f\u4e92\u76f8\u5f15\u7528\u7528 shared_ptr \u7684\u60c5\u51b5                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3259207\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : GeruzoniAnsasu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Tree-&gt;GetLength(Frame*) \uff1f\uff1f<\/p>\n<p>\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u662f Tree-&gt;Frame-&gt;GetLength \uff1f<\/p>\n<p>\u4e3a\u4ec0\u4e48 Frame \u8981\u77e5\u9053 Tree \u7ed3\u6784\u7684\u4fe1\u606f\uff1f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3259208\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : afx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @1YsX1 \u4eba\u5bb6\u662f\u8ba9\u4f60\u51fd\u6570\u7684\u58f0\u660e\u548c\u5b9a\u4e49\u5206\u5f00\uff0c\u4e0d\u8981\u90fd\u5199\u5728\u5934\u6587\u4ef6\u91cc\uff0c\u800c\u4e0d\u662f\u4e0d\u8981\u5934\u6587\u4ef6\u3002\u58f0\u660e\u5728\u5934\u6587\u4ef6\uff0c\u5b9e\u73b0\u5199\u5728.cpp \u6587\u4ef6\u5c31\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u89e3\u51b3 C++\u4e24\u4e2a\u7c7b\u9700\u8981\u4e92\u76f8\u5f15\u7528&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/156524"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=156524"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/156524\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=156524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=156524"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=156524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}