{"id":40035,"date":"2023-12-11T14:49:32","date_gmt":"2023-12-11T06:49:32","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=40035"},"modified":"2023-12-11T14:49:32","modified_gmt":"2023-12-11T06:49:32","slug":"%e8%af%b7%e4%bd%a0%e8%af%a6%e7%bb%86%e4%bb%8b%e7%bb%8d%e4%b8%80%e4%b8%8bc11%e4%b8%ad%e7%9a%84%e5%8f%af%e5%8f%98%e5%8f%82%e6%95%b0%e6%a8%a1%e6%9d%bf%e3%80%81%e5%8f%b3%e5%80%bc%e5%bc%95%e7%94%a8","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/11\/%e8%af%b7%e4%bd%a0%e8%af%a6%e7%bb%86%e4%bb%8b%e7%bb%8d%e4%b8%80%e4%b8%8bc11%e4%b8%ad%e7%9a%84%e5%8f%af%e5%8f%98%e5%8f%82%e6%95%b0%e6%a8%a1%e6%9d%bf%e3%80%81%e5%8f%b3%e5%80%bc%e5%bc%95%e7%94%a8\/","title":{"rendered":"\u8bf7\u4f60\u8be6\u7ec6\u4ecb\u7ecd\u4e00\u4e0bC++11\u4e2d\u7684\u53ef\u53d8\u53c2\u6570\u6a21\u677f\u3001\u53f3\u503c\u5f15\u7528\u548clambda\u8fd9\u51e0\u4e2a\u65b0\u7279\u6027\u3002"},"content":{"rendered":"<p>&#8220;`&#8221;                    \u53ef\u53d8\u53c2\u6570\u6a21\u677f\uff1a<\/p>\n<p>C++11\u7684\u53ef\u53d8\u53c2\u6570\u6a21\u677f\uff0c\u5bf9\u53c2\u6570\u8fdb\u884c\u4e86\u9ad8\u5ea6\u6cdb\u5316\uff0c\u53ef\u4ee5\u8868\u793a\u4efb\u610f\u6570\u76ee\u3001\u4efb\u610f\u7c7b\u578b\u7684\u53c2\u6570\uff0c\u5176\u8bed\u6cd5\u4e3a\uff1a\u5728class\u6216typename\u540e\u9762\u5e26\u4e0a\u7701\u7565\u53f7\u201d\u3002<\/p>\n<p>\u4f8b\u5982\uff1a&lt;\/p&gt;<\/p>\n<p>&lt;pre&gt;&lt;code&gt;Template&lt;class &#8230; T&gt;void func(T &#8230; args){cout&lt;&lt;\u201dnum is\u201d&lt;&lt;sizeof &#8230;(args)&lt;&lt;endl;}&lt;\/code&gt;&lt;\/pre&gt;<\/p>\n<p>func();\/\/args\u4e0d\u542b\u4efb\u4f55\u53c2\u6570<\/p>\n<p>func(1);\/\/args\u5305\u542b\u4e00\u4e2aint\u7c7b\u578b\u7684\u5b9e\u53c2<\/p>\n<p>func(1,2.0)\/\/args\u5305\u542b\u4e00\u4e2aint\u4e00\u4e2adouble\u7c7b\u578b\u7684\u5b9e\u53c2<\/p>\n<p>\u5176\u4e2dT\u53eb\u505a\u6a21\u677f\u53c2\u6570\u5305\uff0cargs\u53eb\u505a\u51fd\u6570\u53c2\u6570\u5305<\/p>\n<p>\u7701\u7565\u53f7\u4f5c\u7528\u5982\u4e0b\uff1a<\/p>\n<p>1\uff09\u58f0\u660e\u4e00\u4e2a\u5305\u542b0\u5230\u4efb\u610f\u4e2a\u6a21\u677f\u53c2\u6570\u7684\u53c2\u6570\u5305<\/p>\n<p>2\uff09\u5728\u6a21\u677f\u5b9a\u4e49\u5f97\u53f3\u8fb9\uff0c\u53ef\u4ee5\u5c06\u53c2\u6570\u5305\u5c55\u6210\u4e00\u4e2a\u4e2a\u72ec\u7acb\u7684\u53c2\u6570<\/p>\n<p>C++11\u53ef\u4ee5\u4f7f\u7528\u9012\u5f52\u51fd\u6570\u7684\u65b9\u5f0f\u5c55\u5f00\u53c2\u6570\u5305\uff0c\u83b7\u5f97\u53ef\u53d8\u53c2\u6570\u7684\u6bcf\u4e2a\u503c\u3002\u901a\u8fc7\u9012\u5f52\u51fd\u6570\u5c55\u5f00\u53c2\u6570\u5305\uff0c\u9700\u8981\u63d0\u4f9b\u4e00\u4e2a\u53c2\u6570\u5305\u5c55\u5f00\u7684\u51fd\u6570\u548c\u4e00\u4e2a\u9012\u5f52\u7ec8\u6b62\u51fd\u6570\u3002\u4f8b\u5982\uff1a<\/p>\n<p>#include using namespace std;<\/p>\n<p>\/\/ \u6700\u7ec8\u9012\u5f52\u51fd\u6570<\/p>\n<p>void print()<\/p>\n<p>{<\/p>\n<p>cout &lt;&lt; &quot;&quot;empty&quot;&quot; &lt;&lt; endl;<\/p>\n<p>}<\/p>\n<p>\/\/ \u5c55\u5f00\u51fd\u6570<\/p>\n<p>&lt;pre&gt;&lt;code&gt;template void print(T head, Args&#8230; args){cout &lt;&lt; head &lt;&lt; &quot;&quot;,&quot;&quot;; print(args&#8230;);}int main(){print(1, 2, 3, 4); return 0;}&lt;\/code&gt;&lt;\/pre&gt;<\/p>\n<p>\u53c2\u6570\u5305Args &#8230;\u5728\u5c55\u5f00\u7684\u8fc7\u7a0b\u4e2d\u9012\u5f52\u8c03\u7528\u81ea\u5df1\uff0c\u6ca1\u8c03\u7528\u4e00\u6b21\u53c2\u6570\u5305\u4e2d\u7684\u53c2\u6570\u5c31\u4f1a\u5c11\u4e00\u4e2a\uff0c\u76f4\u5230\u6240\u6709\u53c2\u6570\u90fd\u5c55\u5f00\u4e3a\u6b62\u3002\u5f53\u6ca1\u6709\u53c2\u6570\u65f6\u5c31\u4f1a\u8c03\u7528\u975e\u6a21\u677f\u51fd\u6570printf\u7ec8\u6b62\u9012\u5f52\u8fc7\u7a0b\u3002<\/p>\n<p>\u53f3\u503c\u5f15\u7528:<\/p>\n<p>C++\u4e2d\uff0c\u5de6\u503c\u901a\u5e38\u6307\u53ef\u4ee5\u53d6\u5730\u5740\uff0c\u6709\u540d\u5b57\u7684\u503c\u5c31\u662f\u5de6\u503c\uff0c\u800c\u4e0d\u80fd\u53d6\u5730\u5740\uff0c\u6ca1\u6709\u540d\u5b57\u7684\u5c31\u662f\u53f3\u503c\u3002\u800c\u5728\u6307C++11\u4e2d\uff0c\u53f3\u503c\u662f\u7531\u4e24\u4e2a\u6982\u5ff5\u6784\u6210\uff0c\u5c06\u4ea1\u503c\u548c\u7eaf\u53f3\u503c\u3002\u7eaf\u53f3\u503c\u662f\u7528\u4e8e\u8bc6\u522b\u4e34\u65f6\u53d8\u91cf\u548c\u4e00\u4e9b\u4e0d\u8ddf\u5bf9\u8c61\u5173\u8054\u7684\u503c\uff0c\u6bd4\u59821+3\u4ea7\u751f\u7684\u4e34\u65f6\u53d8\u91cf\u503c\uff0c2\u3001true\u7b49\uff0c\u800c\u5c06\u4ea1\u503c\u901a\u5e38\u662f\u6307\u5177\u6709\u8f6c\u79fb\u8bed\u4e49\u7684\u5bf9\u8c61\uff0c\u6bd4\u5982\u8fd4\u56de\u53f3\u503c\u5f15\u7528T&amp;&amp;\u7684\u51fd\u6570\u8fd4\u56de\u503c\u7b49\u3002<\/p>\n<p>C++11\u4e2d\uff0c\u53f3\u503c\u5f15\u7528\u5c31\u662f\u5bf9\u4e00\u4e2a\u53f3\u503c\u8fdb\u884c\u5f15\u7528\u7684\u7c7b\u578b\u3002\u7531\u4e8e\u53f3\u503c\u901a\u5e38\u4e0d\u5177\u6709\u540d\u5b57\uff0c\u6240\u4ee5\u6211\u4eec\u4e00\u822c\u53ea\u80fd\u901a\u8fc7\u53f3\u503c\u8868\u8fbe\u5f0f\u83b7\u5f97\u5176\u5f15\u7528\uff0c\u6bd4\u5982\uff1a<\/p>\n<p>T &amp;&amp; a=ReturnRvale();<\/p>\n<p>\u5047\u8bbeReturnRvalue()\u51fd\u6570\u8fd4\u56de\u4e00\u4e2a\u53f3\u503c\uff0c\u90a3\u4e48\u4e0a\u8ff0\u8bed\u53e5\u58f0\u660e\u4e86\u4e00\u4e2a\u540d\u4e3aa\u7684\u53f3\u503c\u5f15\u7528\uff0c\u5176\u503c\u7b49\u4e8eReturnRvalue\u51fd\u6570\u8fd4\u56de\u7684\u4e34\u65f6\u53d8\u91cf\u7684\u503c\u3002<\/p>\n<p>\u57fa\u4e8e\u53f3\u503c\u5f15\u7528\u53ef\u4ee5\u5b9e\u73b0\u8f6c\u79fb\u8bed\u4e49\u548c\u5b8c\u7f8e\u8f6c\u53d1\u65b0\u7279\u6027\u3002<\/p>\n<p>\u79fb\u52a8\u8bed\u4e49\uff1a<\/p>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u5305\u542b\u6307\u9488\u6210\u5458\u53d8\u91cf\u7684\u7c7b\uff0c\u7531\u4e8e\u7f16\u8bd1\u5668\u9ed8\u8ba4\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u90fd\u662f\u6d45\u62f7\u8d1d\uff0c\u6240\u6709\u6211\u4eec\u4e00\u822c\u9700\u8981\u901a\u8fc7\u5b9e\u73b0\u6df1\u62f7\u8d1d\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570\uff0c\u4e3a\u6307\u9488\u6210\u5458\u5206\u914d\u65b0\u7684\u5185\u5b58\u5e76\u8fdb\u884c\u5185\u5bb9\u62f7\u8d1d\uff0c\u4ece\u800c\u907f\u514d\u60ac\u6302\u6307\u9488\u7684\u95ee\u9898\u3002<\/p>\n<p>\u4f46\u662f\u5982\u4e0b\u5217\u4ee3\u7801\u6240\u793a\uff1a<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191321535_58A744363913E79F3AD5742FA81DCBAE&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u5f53\u7c7bHasPtrMem\u5305\u542b\u4e00\u4e2a\u6210\u5458\u51fd\u6570GetTemp,\u5176\u8fd4\u56de\u503c\u7c7b\u578b\u662fHasPtrMem,\u5982\u679c\u6211\u4eec\u5b9a\u4e49\u4e86\u6df1\u62f7\u8d1d\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570\uff0c\u90a3\u4e48\u5728\u8c03\u7528\u8be5\u51fd\u6570\u65f6\u9700\u8981\u8c03\u7528\u4e24\u6b21\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u3002\u7b2c\u4e00\u6b21\u662f\u751f\u6210GetTemp\u51fd\u6570\u8fd4\u56de\u65f6\u7684\u4e34\u65f6\u53d8\u91cf\uff0c\u7b2c\u4e8c\u6b21\u662f\u5c06\u8be5\u8fd4\u56de\u503c\u8d4b\u503c\u7ed9main\u51fd\u6570\u4e2d\u7684\u53d8\u91cfa\u3002\u4e0e\u6b64\u5bf9\u5e94\u9700\u8981\u8c03\u7528\u4e09\u6b21\u6790\u6784\u51fd\u6570\u6765\u91ca\u653e\u5185\u5b58\u3002<\/p>\n<p>\u800c\u5728\u4e0a\u8ff0\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528\u4e34\u65f6\u53d8\u91cf\u6784\u9020a\u65f6\u4f1a\u8c03\u7528\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u5206\u914d\u5bf9\u5185\u5b58\uff0c\u800c\u4e34\u65f6\u5bf9\u8c61\u5728\u8bed\u53e5\u7ed3\u675f\u540e\u4f1a\u91ca\u653e\u5b83\u6240\u4f7f\u7528\u7684\u5806\u5185\u5b58\u3002\u8fd9\u6837\u91cd\u590d\u7533\u8bf7\u548c\u91ca\u653e\u5185\u5b58\uff0c\u5728\u7533\u8bf7\u5185\u5b58\u8f83\u5927\u65f6\u4f1a\u4e25\u91cd\u5f71\u54cd\u6027\u80fd\u3002\u56e0\u6b64C++\u4f7f\u7528\u79fb\u52a8\u6784\u9020\u51fd\u6570\uff0c\u4ece\u800c\u4fdd\u8bc1\u4f7f\u7528\u4e34\u65f6\u5bf9\u8c61\u6784\u9020a\u65f6\u4e0d\u5206\u914d\u5185\u5b58\uff0c\u4ece\u800c\u63d0\u9ad8\u6027\u80fd\u3002<\/p>\n<p>\u5982\u4e0b\u5217\u4ee3\u7801\u6240\u793a\uff0c\u79fb\u52a8\u6784\u9020\u51fd\u6570\u63a5\u6536\u4e00\u4e2a\u53f3\u503c\u5f15\u7528\u4f5c\u4e3a\u53c2\u6570\uff0c\u4f7f\u7528\u53f3\u503c\u5f15\u7528\u7684\u53c2\u6570\u521d\u59cb\u5316\u5176\u6307\u9488\u6210\u5458\u53d8\u91cf\u3002<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191343421_462F4D51399618549AADC7EEFD2558BD&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u5176\u539f\u7406\u5c31\u662f\u4f7f\u7528\u5728\u6784\u9020\u5bf9\u8c61a\u65f6\uff0c\u4f7f\u7528h.d\u6765\u521d\u59cb\u5316a\uff0c\u7136\u540e\u5c06\u4e34\u65f6\u5bf9\u8c61h\u7684\u6210\u5458\u53d8\u91cfd\u6307\u5411nullptr\uff0c\u4ece\u800c\u4fdd\u8bc1\u4e34\u65f6\u53d8\u91cf\u6790\u6784\u65f6\u4e0d\u4f1a\u91ca\u653e\u5bf9\u5185\u5b58\u3002<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191352653_88EEF7DC9BD18B099C522481527F5CE3&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u5b8c\u7f8e\u8f6c\u53d1\uff1a<\/p>\n<p>\u5b8c\u7f8e\u8f6c\u53d1\u662f\u6307\u5728\u51fd\u6570\u6a21\u677f\u4e2d\uff0c\u5b8c\u5168\u4f9d\u7167\u6a21\u677f\u7684\u53c2\u6570\u7684\u7c7b\u578b\uff0c\u5c06\u53c2\u6570\u4f20\u9012\u7ed9\u51fd\u6570\u6a21\u677f\u4e2d\u8c03\u7528\u7684\u53e6\u4e00\u4e2a\u51fd\u6570\uff0c\u5373\u4f20\u5165\u8f6c\u53d1\u51fd\u6570\u7684\u662f\u5de6\u503c\u5bf9\u8c61\uff0c\u76ee\u6807\u51fd\u6570\u5c31\u80fd\u83b7\u5f97\u5de6\u503c\u5bf9\u8c61\uff0c\u8f6c\u53d1\u51fd\u6570\u662f\u53f3\u503c\u5bf9\u8c61\uff0c\u76ee\u6807\u51fd\u6570\u5c31\u80fd\u83b7\u5f97\u53f3\u503c\u5bf9\u8c61\uff0c\u800c\u4e0d\u4ea7\u751f\u989d\u5916\u7684\u5f00\u9500\u3002<\/p>\n<p>\u56e0\u6b64\u8f6c\u53d1\u51fd\u6570\u548c\u76ee\u6807\u51fd\u6570\u53c2\u6570\u4e00\u822c\u91c7\u7528\u5f15\u7528\u7c7b\u578b\uff0c\u4ece\u800c\u907f\u514d\u62f7\u8d1d\u7684\u5f00\u9500\u3002\u5176\u6b21\uff0c\u7531\u4e8e\u76ee\u6807\u51fd\u6570\u53ef\u80fd\u9700\u8981\u80fd\u591f\u65e2\u63a5\u53d7\u5de6\u503c\u5f15\u7528\uff0c\u53c8\u63a5\u53d7\u53f3\u503c\u5f15\u7528\uff0c\u6240\u4ee5\u8003\u8651\u8f6c\u53d1\u4e5f\u9700\u8981\u517c\u5bb9\u8fd9\u4e24\u79cd\u7c7b\u578b\u3002<\/p>\n<p>C++11\u91c7\u7528\u5f15\u7528\u6298\u53e0\u7684\u89c4\u5219\uff0c\u7ed3\u5408\u65b0\u7684\u6a21\u677f\u63a8\u5bfc\u89c4\u5219\u5b9e\u73b0\u5b8c\u7f8e\u8f6c\u53d1\u3002\u5176\u5f15\u7528\u6298\u53e0\u89c4\u5219\u5982\u4e0b\uff1a<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191363531_0FAB347499C02FF2A53B2E5719DFFDCE&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u56e0\u6b64\uff0c\u6211\u4eec\u5c06\u8f6c\u53d1\u51fd\u6570\u548c\u76ee\u6807\u51fd\u6570\u7684\u53c2\u6570\u90fd\u8bbe\u7f6e\u4e3a\u53f3\u503c\u5f15\u7528\u7c7b\u578b\uff0c<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191372436_751F242F40E83204A02C51EE6E6F59C8&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u5f53\u4f20\u5165\u4e00\u4e2aX\u7c7b\u578b\u7684\u5de6\u503c\u5f15\u7528\u65f6\uff0c\u8f6c\u53d1\u51fd\u6570\u5c06\u88ab\u5b9e\u4f8b\u4e3a\uff1a<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191379108_56A9F9A6063E926522868B216C5723C3&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u7ecf\u8fc7\u5f15\u7528\u6298\u53e0\uff0c\u53d8\u4e3a\uff1a<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191386307_6474E6FC6FFC82F2E36AEDF32C2A9AF7&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u5f53\u4f20\u5165\u4e00\u4e2aX\u7c7b\u578b\u7684\u53f3\u503c\u5f15\u7528\u65f6\uff0c\u8f6c\u53d1\u51fd\u6570\u5c06\u88ab\u5b9e\u4f8b\u4e3a\uff1a<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191392964_29CEF6AA3EFA9DA07FEFD9FAA986A303&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u7ecf\u8fc7\u5f15\u7528\u6298\u53e0\uff0c\u53d8\u4e3a\uff1a<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191399205_49C2489FE4420DAECF6D97BFE94F06EE&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>\u9664\u6b64\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528forward()\u51fd\u6570\u6765\u5b8c\u6210\u5de6\u503c\u5f15\u7528\u5230\u53f3\u503c\u5f15\u7528\u7684\u8f6c\u6362\uff1a<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191407573_A2019744F42C6BE3527BE38B3D0CD1EE&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>Lambda\u8868\u8fbe\u5f0f:<\/p>\n<p>Lambda\u8868\u8fbe\u5f0f\u5b9a\u4e49\u4e00\u4e2a\u533f\u540d\u51fd\u6570\uff0c\u5e76\u4e14\u53ef\u4ee5\u6355\u83b7\u4e00\u5b9a\u8303\u56f4\u5185\u7684\u53d8\u91cf\uff0c\u5176\u5b9a\u4e49\u5982\u4e0b\uff1a<\/p>\n<p>&lt;a href=&quot;&quot;http:\/\/params&quot;&quot;&gt;capture&lt;\/a&gt;mutable-&gt;return-type{statement}<\/p>\n<p>\u5176\u4e2d\uff0c<\/p>\n<p>[capture]\uff1a\u6355\u83b7\u5217\u8868\uff0c\u6355\u83b7\u4e0a\u4e0b\u6587\u53d8\u91cf\u4ee5\u4f9blambda\u4f7f\u7528\u3002\u540c\u65f6[]\u662flambda\u5bc5\u521d\u590d\uff0c\u7f16\u8bd1\u5668\u6839\u636e\u8be5\u7b26\u53f7\u6765\u5224\u65ad\u63a5\u4e0b\u6765\u4ee3\u7801\u662f\u5426\u662flambda\u51fd\u6570\u3002<\/p>\n<p>(Params)\uff1a\u53c2\u6570\u5217\u8868\uff0c\u4e0e\u666e\u901a\u51fd\u6570\u7684\u53c2\u6570\u5217\u8868\u4e00\u81f4\uff0c\u5982\u679c\u4e0d\u9700\u8981\u4f20\u9012\u53c2\u6570\uff0c\u5219\u53ef\u4ee5\u8fde\u901a\u62ec\u53f7\u4e00\u8d77\u7701\u7565\u3002<\/p>\n<p>mutable\u662f\u4fee\u9970\u7b26\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0blambda\u51fd\u6570\u603b\u662f\u4e00\u4e2aconst\u51fd\u6570\uff0cMutable\u53ef\u4ee5\u53d6\u6d88\u5176\u5e38\u91cf\u6027\u3002\u5728\u4f7f\u7528\u8be5\u4fee\u9970\u7b26\u65f6\uff0c\u53c2\u6570\u5217\u8868\u4e0d\u53ef\u7701\u7565\u3002<\/p>\n<p>-&gt;return-type:\u8fd4\u56de\u7c7b\u578b\u662f\u8fd4\u56de\u503c\u7c7b\u578b<\/p>\n<p>{statement}:\u51fd\u6570\u4f53\uff0c\u5185\u5bb9\u4e0e\u666e\u901a\u51fd\u6570\u4e00\u6837\uff0c\u9664\u4e86\u53ef\u4ee5\u4f7f\u7528\u53c2\u6570\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u6240\u6355\u83b7\u7684\u53d8\u91cf\u3002<\/p>\n<p>Lambda\u8868\u8fbe\u5f0f\u4e0e\u666e\u901a\u51fd\u6570\u6700\u5927\u7684\u533a\u522b\u5c31\u662f\u5176\u53ef\u4ee5\u901a\u8fc7\u6355\u83b7\u5217\u8868\u8bbf\u95ee\u4e00\u4e9b\u4e0a\u4e0b\u6587\u4e2d\u7684\u6570\u636e\u3002\u5176\u5f62\u5f0f\u5982\u4e0b:<\/p>\n<p>&lt;img src=&quot;&quot;https:\/\/uploadfiles.nowcoder.com\/images\/20190911\/826546_1568191417971_1765C38D76453E701E78C4FC12904FBA&quot;&quot; referrerpolicy=&quot;&quot;no-referrer&quot;&quot; alt=&quot;&quot;img&quot;&quot;&gt;<\/p>\n<p>Lambda\u7684\u7c7b\u578b\u88ab\u5b9a\u4e49\u4e3a\u201c\u95ed\u5305\u201d\u7684\u7c7b\uff0c\u5176\u901a\u5e38\u7528\u4e8eSTL\u5e93\u4e2d\uff0c\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\u53ef\u7528\u4e8e\u7b80\u5316\u4eff\u51fd\u6570\u7684\u4f7f\u7528\uff0c\u540c\u65f6Lambda\u4f5c\u4e3a\u5c40\u90e8\u51fd\u6570\uff0c\u4e5f\u4f1a\u63d0\u9ad8\u590d\u6742\u4ee3\u7801\u7684\u5f00\u53d1\u52a0\u901f\uff0c\u8f7b\u677e\u5728\u51fd\u6570\u5185\u91cd\u7528\u4ee3\u7801\uff0c\u65e0\u987b\u8d39\u5fc3\u8bbe\u8ba1\u63a5\u53e3\u3002<\/p>\n<p>&lt;pre&gt;&lt;code&gt;            &quot;&#8220;`<br \/>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;`&#8221; \u53ef\u53d8\u53c2\u6570\u6a21\u677f\uff1a C++11\u7684\u53ef\u53d8\u53c2\u6570\u6a21\u677f\uff0c\u5bf9\u53c2\u6570\u8fdb\u884c\u4e86\u9ad8\u5ea6\u6cdb\u5316\uff0c\u53ef\u4ee5\u8868\u793a\u4efb\u610f\u6570 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-40035","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/40035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=40035"}],"version-history":[{"count":1,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/40035\/revisions"}],"predecessor-version":[{"id":40036,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/40035\/revisions\/40036"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=40035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=40035"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=40035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}