{"id":115555,"date":"2026-10-12T15:17:16","date_gmt":"2026-10-12T07:17:16","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115555.html"},"modified":"2026-10-12T15:17:16","modified_gmt":"2026-10-12T07:17:16","slug":"c11%e6%a0%b8%e5%bf%83%e7%89%b9%e6%80%a7%e8%af%a6%e8%a7%a3%ef%bc%9a%e4%bb%8ec11%e5%88%b0c20-%e7%9a%84%e7%8e%b0%e4%bb%a3c%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115555.html","title":{"rendered":"C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357"},"content":{"rendered":"<h3>1. \u5f15\u8a00<\/h3>\n<p>C&#043;&#043; \u8bed\u8a00\u5728\u957f\u671f\u6f14\u8fdb\u8fc7\u7a0b\u4e2d&#xff0c;\u6bcf\u9694\u6570\u5e74\u4fbf\u4f1a\u53d1\u5e03\u4e00\u4e2a\u65b0\u7684\u6807\u51c6\u7248\u672c\u3002\u5176\u4e2d C&#043;&#043;11 \u88ab\u5e7f\u6cdb\u89c6\u4e3a\u4e00\u6b21\u91cc\u7a0b\u7891\u5f0f\u7684\u66f4\u65b0&#xff0c;\u5b83\u8ba9 C&#043;&#043; \u4ece\u4e00\u95e8\u504f\u4f20\u7edf\u7684\u7cfb\u7edf\u7ea7\u8bed\u8a00&#xff0c;\u8f6c\u53d8\u4e3a\u66f4\u73b0\u4ee3\u3001\u66f4\u5b89\u5168\u3001\u66f4\u6613\u7528\u7684\u5f00\u53d1\u8bed\u8a00\u3002\u968f\u540e C&#043;&#043;14\u3001C&#043;&#043;17 \u548c C&#043;&#043;20 \u5728 C&#043;&#043;11 \u7684\u57fa\u7840\u4e0a\u6301\u7eed\u5b8c\u5584&#xff0c;\u4e0d\u65ad\u5f15\u5165\u65b0\u7279\u6027\u3002\u672c\u6587\u5148\u7cfb\u7edf\u68b3\u7406 C&#043;&#043;11 \u7684\u6838\u5fc3\u7279\u6027&#xff0c;\u518d\u5206\u522b\u4ecb\u7ecd C&#043;&#043;14\u3001C&#043;&#043;17 \u4e0e C&#043;&#043;20 \u7684\u4e3b\u8981\u65b0\u589e\u5185\u5bb9&#xff0c;\u5e2e\u52a9\u8bfb\u8005\u5efa\u7acb\u5bf9\u73b0\u4ee3 C&#043;&#043; \u7684\u6574\u4f53\u8ba4\u77e5\u3002\u5efa\u8bae\u8bfb\u8005\u5728\u9605\u8bfb\u65f6\u7ed3\u5408\u4ee3\u7801\u793a\u4f8b\u52a8\u624b\u5b9e\u8df5&#xff0c;\u4ee5\u52a0\u6df1\u5bf9\u5404\u9879\u7279\u6027\u7684\u7406\u89e3\u3002<\/p>\n<h3>2. C&#043;&#043;11\u7279\u6027<\/h3>\n<p>C&#043;&#043;11 \u662f C&#043;&#043; \u8bed\u8a00\u53d1\u5c55\u53f2\u4e0a\u7684\u4e00\u5ea7\u91cc\u7a0b\u7891&#xff0c;\u5b83\u8ba9\u8fd9\u95e8\u8bed\u8a00\u4ece\u504f\u4f20\u7edf\u7684\u7cfb\u7edf\u7ea7\u8bed\u8a00&#xff0c;\u8f6c\u53d8\u4e3a\u66f4\u73b0\u4ee3\u3001\u66f4\u5b89\u5168\u3001\u66f4\u6613\u7528\u7684\u5f00\u53d1\u8bed\u8a00\u3002\u4e0b\u9762\u4ece\u8bed\u8a00\u57fa\u7840\u3001\u9762\u5411\u5bf9\u8c61\u3001\u6a21\u677f\u3001\u6807\u51c6\u5e93\u7b49\u591a\u4e2a\u7ef4\u5ea6&#xff0c;\u7cfb\u7edf\u68b3\u7406 C&#043;&#043;11 \u7684\u6838\u5fc3\u7279\u6027&#xff0c;\u5e76\u5bf9\u6bcf\u4e2a\u7279\u6027\u8fdb\u884c\u8be6\u7ec6\u8bb2\u89e3\u3002<\/p>\n<h4>2.1 \u57fa\u7840\u7279\u6027<\/h4>\n<p>auto \u5173\u952e\u5b57\u8ba9\u7f16\u8bd1\u5668\u6839\u636e\u521d\u59cb\u5316\u8868\u8fbe\u5f0f\u81ea\u52a8\u63a8\u5bfc\u53d8\u91cf\u7c7b\u578b&#xff0c;\u663e\u8457\u51cf\u5c11\u5197\u957f\u7684\u7c7b\u578b\u58f0\u660e\u3002\u4f8b\u5982&#xff0c;auto x &#061; 42; \u4f1a\u81ea\u52a8\u63a8\u5bfc x \u4e3a int \u7c7b\u578b&#xff0c;auto s &#061; std::string(&#034;hello&#034;); \u4f1a\u81ea\u52a8\u63a8\u5bfc\u4e3a std::string\u3002\u8fd9\u4e0d\u4ec5\u8ba9\u4ee3\u7801\u66f4\u7b80\u6d01&#xff0c;\u8fd8\u80fd\u907f\u514d\u56e0\u7c7b\u578b\u5199\u9519\u800c\u5bfc\u81f4\u7684\u9690\u5f0f\u8f6c\u6362\u95ee\u9898\u3002\u914d\u5408 decltype \u53ef\u4ee5\u5728\u7f16\u8bd1\u671f\u83b7\u53d6\u8868\u8fbe\u5f0f\u7684\u7c7b\u578b&#xff0c;\u5e38\u7528\u4e8e\u6a21\u677f\u7f16\u7a0b\u4e2d\u63a8\u5bfc\u8fd4\u56de\u503c\u7c7b\u578b\u3002<\/p>\n<p>#include &lt;vector&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nint main() {<br \/>\n    std::vector&lt;int&gt; nums &#061; {1, 2, 3, 4, 5};<br \/>\n    for (auto n : nums) {<br \/>\n        std::cout &lt;&lt; n &lt;&lt; &#034; &#034;;<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u8303\u56f4 for \u5faa\u73af&#xff08;range-based for&#xff09;\u5219\u8ba9\u904d\u5386\u5bb9\u5668\u53d8\u5f97\u66f4\u52a0\u7b80\u6d01\u76f4\u89c2&#xff0c;\u65e0\u9700\u518d\u624b\u52a8\u7ba1\u7406\u8fed\u4ee3\u5668\u3002\u6b64\u5916&#xff0c;C&#043;&#043;11 \u8fd8\u5f15\u5165\u4e86 nullptr \u53d6\u4ee3 NULL \u548c 0&#xff0c;\u6210\u4e3a\u7c7b\u578b\u5b89\u5168\u7684\u7a7a\u6307\u9488\u5e38\u91cf&#xff0c;\u907f\u514d\u4e86 NULL \u5728\u91cd\u8f7d\u89e3\u6790\u65f6\u53ef\u80fd\u4ea7\u751f\u7684\u6b67\u4e49&#xff1b;constexpr \u5141\u8bb8\u58f0\u660e\u7f16\u8bd1\u671f\u53ef\u6c42\u503c\u7684\u5e38\u91cf\u8868\u8fbe\u5f0f\u51fd\u6570&#xff0c;\u8ba9\u7f16\u8bd1\u5668\u5728\u7f16\u8bd1\u9636\u6bb5\u5c31\u80fd\u8ba1\u7b97\u51fa\u7ed3\u679c&#xff0c;\u63d0\u5347\u8fd0\u884c\u6548\u7387&#xff1b;\u5f3a\u7c7b\u578b\u679a\u4e3e&#xff08;enum class&#xff09;\u63d0\u4f9b\u4f5c\u7528\u57df\u548c\u5e95\u5c42\u7c7b\u578b\u63a7\u5236&#xff0c;\u907f\u514d\u679a\u4e3e\u503c\u6c61\u67d3\u5916\u90e8\u547d\u540d\u7a7a\u95f4&#xff1b;\u9759\u6001\u65ad\u8a00&#xff08;static_assert&#xff09;\u5728\u7f16\u8bd1\u671f\u68c0\u67e5\u6761\u4ef6&#xff0c;\u4e00\u65e6\u4e0d\u6ee1\u8db3\u7acb\u5373\u62a5\u9519&#xff0c;\u628a\u9519\u8bef\u63d0\u524d\u5230\u7f16\u8bd1\u9636\u6bb5&#xff1b;\u4e8c\u8fdb\u5236\u5b57\u9762\u91cf \u548c \u6570\u5b57\u5206\u9694\u7b26 \u8ba9\u6570\u503c\u8868\u8fbe\u66f4\u76f4\u89c2&#xff0c;\u4f8b\u5982 0b1010 \u8868\u793a\u4e8c\u8fdb\u5236 10&#xff0c;1&#039;000&#039;000 \u8ba9\u5927\u6570\u5b57\u66f4\u6613\u8bfb\u3002<\/p>\n<h4>2.2 \u9762\u5411\u5bf9\u8c61\u4e0e\u5185\u5b58\u7ba1\u7406<\/h4>\n<p>C&#043;&#043;11 \u5f15\u5165\u4e86 std::shared_ptr\u3001std::unique_ptr \u548c std::weak_ptr \u4e09\u79cd\u667a\u80fd\u6307\u9488&#xff0c;\u7528\u4e8e\u81ea\u52a8\u7ba1\u7406\u52a8\u6001\u5185\u5b58&#xff0c;\u4ece\u6839\u6e90\u4e0a\u51cf\u5c11\u5185\u5b58\u6cc4\u6f0f\u548c\u60ac\u5782\u6307\u9488\u95ee\u9898\u3002\u5176\u4e2d unique_ptr \u72ec\u5360\u6240\u6709\u6743&#xff0c;\u4e0d\u53ef\u62f7\u8d1d\u4f46\u53ef\u79fb\u52a8&#xff0c;\u9002\u5408\u8d44\u6e90\u72ec\u5360\u573a\u666f&#xff1b;shared_ptr \u901a\u8fc7\u5f15\u7528\u8ba1\u6570\u5b9e\u73b0\u5171\u4eab\u6240\u6709\u6743&#xff0c;\u591a\u4e2a\u6307\u9488\u53ef\u6307\u5411\u540c\u4e00\u5bf9\u8c61&#xff0c;\u8ba1\u6570\u5f52\u96f6\u65f6\u81ea\u52a8\u91ca\u653e&#xff1b;weak_ptr \u7528\u4e8e\u6253\u7834\u5faa\u73af\u5f15\u7528&#xff0c;\u5b83\u4e0d\u589e\u52a0\u5f15\u7528\u8ba1\u6570&#xff0c;\u53ea\u63d0\u4f9b\u5bf9\u5bf9\u8c61\u7684\u5f31\u5f15\u7528&#xff0c;\u9700\u8981\u65f6\u901a\u8fc7 lock() \u63d0\u5347\u4e3a shared_ptr\u3002<\/p>\n<p>#include &lt;memory&gt;<br \/>\nvoid demo() {<br \/>\n    auto p &#061; std::make_shared&lt;int&gt;(42);<br \/>\n    std::unique_ptr&lt;int&gt; q &#061; std::make_unique&lt;int&gt;(10);<br \/>\n}<\/p>\n<p>\u5728\u7c7b\u8bbe\u8ba1\u65b9\u9762&#xff0c;C&#043;&#043;11 \u652f\u6301 \u59d4\u6258\u6784\u9020\u51fd\u6570&#xff0c;\u6784\u9020\u51fd\u6570\u53ef\u4ee5\u8c03\u7528\u540c\u7c7b\u4e2d\u7684\u5176\u4ed6\u6784\u9020\u51fd\u6570&#xff0c;\u907f\u514d\u4ee3\u7801\u91cd\u590d&#xff1b;\u663e\u5f0f\u8f6c\u6362\u8fd0\u7b97\u7b26 \u8ba9 explicit \u53ef\u7528\u4e8e\u8f6c\u6362\u8fd0\u7b97\u7b26&#xff0c;\u9632\u6b62\u9690\u5f0f\u7c7b\u578b\u8f6c\u6362\u5e26\u6765\u7684\u610f\u5916&#xff1b;\u9ed8\u8ba4\u548c\u5220\u9664\u51fd\u6570&#xff08;&#061;default\u3001&#061;delete&#xff09;\u5141\u8bb8\u663e\u5f0f\u63a7\u5236\u7279\u6b8a\u6210\u5458\u51fd\u6570\u7684\u751f\u6210&#xff0c;\u4f8b\u5982\u7981\u7528\u62f7\u8d1d\u6784\u9020&#xff1b;override \u548c final \u5173\u952e\u5b57\u589e\u5f3a\u4e86\u865a\u51fd\u6570\u91cd\u5199\u7684\u5b89\u5168\u6027&#xff0c;override \u8ba9\u7f16\u8bd1\u5668\u68c0\u67e5\u662f\u5426\u771f\u7684\u91cd\u5199\u4e86\u57fa\u7c7b\u865a\u51fd\u6570&#xff0c;final \u5219\u7981\u6b62\u8fdb\u4e00\u6b65\u6d3e\u751f\u6216\u91cd\u5199\u3002<\/p>\n<h4>2.3 \u79fb\u52a8\u8bed\u4e49\u4e0e\u53f3\u503c\u5f15\u7528<\/h4>\n<p>\u53f3\u503c\u5f15\u7528&#xff08;&amp;&amp;&#xff09;\u548c\u79fb\u52a8\u6784\u9020\u51fd\u6570\u3001\u79fb\u52a8\u8d4b\u503c\u8fd0\u7b97\u7b26\u7684\u5f15\u5165&#xff0c;\u662f C&#043;&#043;11 \u6700\u6838\u5fc3\u7684\u6027\u80fd\u6539\u8fdb\u4e4b\u4e00\u3002\u5de6\u503c\u662f\u6709\u540d\u5b57\u3001\u53ef\u53d6\u5730\u5740\u7684\u5bf9\u8c61&#xff0c;\u53f3\u503c\u662f\u4e34\u65f6\u503c\u6216\u5373\u5c06\u9500\u6bc1\u7684\u503c\u3002\u53f3\u503c\u5f15\u7528\u53ef\u4ee5\u7ed1\u5b9a\u5230\u53f3\u503c&#xff0c;\u4ece\u800c\u8ba9\u8d44\u6e90\u53ef\u4ee5\u9ad8\u6548\u8f6c\u79fb\u800c\u975e\u6df1\u62f7\u8d1d&#xff0c;\u5927\u5e45\u63d0\u5347\u5bb9\u5668\u548c\u5b57\u7b26\u4e32\u7b49\u7c7b\u578b\u7684\u6027\u80fd\u3002\u914d\u5408 std::move \u53ef\u4ee5\u663e\u5f0f\u628a\u5de6\u503c\u8f6c\u6362\u4e3a\u53f3\u503c&#xff0c;\u89e6\u53d1\u79fb\u52a8\u64cd\u4f5c\u3002\u4f8b\u5982&#xff0c;\u628a\u4e00\u4e2a vector \u7684\u5185\u5bb9\u79fb\u52a8\u5230\u53e6\u4e00\u4e2a vector&#xff0c;\u53ea\u9700\u8f6c\u79fb\u5185\u90e8\u6307\u9488&#xff0c;\u65e0\u9700\u590d\u5236\u6240\u6709\u5143\u7d20\u3002<\/p>\n<p>#include &lt;string&gt;<br \/>\n#include &lt;utility&gt;<br \/>\nstd::string a &#061; &#034;hello&#034;;<br \/>\nstd::string b &#061; std::move(a);  \/\/ \u8f6c\u79fb\u8d44\u6e90&#xff0c;\u800c\u975e\u62f7\u8d1d<\/p>\n<p>\u79fb\u52a8\u8bed\u4e49\u8fd8\u50ac\u751f\u4e86&#034;\u79fb\u52a8\u6784\u9020 &#043; \u62f7\u8d1d\u6784\u9020&#034;\u7684\u6210\u5bf9\u8bbe\u8ba1\u6a21\u5f0f&#xff0c;\u8ba9\u6807\u51c6\u5e93\u5bb9\u5668\u5728\u6269\u5bb9\u3001\u63d2\u5165\u7b49\u64cd\u4f5c\u4e2d\u5927\u5e45\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u62f7\u8d1d&#xff0c;\u663e\u8457\u63d0\u5347\u6027\u80fd\u3002<\/p>\n<h4>2.4 Lambda\u8868\u8fbe\u5f0f<\/h4>\n<p>Lambda \u8868\u8fbe\u5f0f\u5141\u8bb8\u5728\u51fd\u6570\u5185\u90e8\u76f4\u63a5\u5b9a\u4e49\u533f\u540d\u51fd\u6570\u5bf9\u8c61&#xff0c;\u914d\u5408\u6807\u51c6\u5e93\u7b97\u6cd5\u4f7f\u7528\u975e\u5e38\u65b9\u4fbf\u3002\u5b83\u7684\u57fa\u672c\u8bed\u6cd5\u662f [\u6355\u83b7\u5217\u8868](\u53c2\u6570\u5217\u8868) -&gt; \u8fd4\u56de\u7c7b\u578b { \u51fd\u6570\u4f53 }\u3002\u6355\u83b7\u5217\u8868\u652f\u6301\u503c\u6355\u83b7&#xff08;[&#061;]&#xff09;\u3001\u5f15\u7528\u6355\u83b7&#xff08;[&amp;]&#xff09;\u4ee5\u53ca\u521d\u59cb\u5316\u6355\u83b7&#xff08;C&#043;&#043;14 \u8d77&#xff09;&#xff0c;\u8fd8\u53ef\u4ee5\u6309\u9700\u6355\u83b7\u7279\u5b9a\u53d8\u91cf&#xff0c;\u5982 [x, &amp;y] \u8868\u793a\u6309\u503c\u6355\u83b7 x\u3001\u6309\u5f15\u7528\u6355\u83b7 y\u3002<\/p>\n<p>#include &lt;vector&gt;<br \/>\n#include &lt;algorithm&gt;<br \/>\nstd::vector&lt;int&gt; v &#061; {5, 2, 8, 1};<br \/>\nstd::sort(v.begin(), v.end(), [](int x, int y) { return x &lt; y; });<\/p>\n<p>\u540c\u65f6&#xff0c;std::function \u63d0\u4f9b\u4e86\u901a\u7528\u7684\u51fd\u6570\u5305\u88c5\u5668&#xff0c;\u53ef\u4ee5\u5b58\u50a8\u4efb\u610f\u53ef\u8c03\u7528\u5bf9\u8c61&#xff08;\u51fd\u6570\u6307\u9488\u3001Lambda\u3001\u51fd\u6570\u5bf9\u8c61\u7b49&#xff09;&#xff0c;std::bind \u652f\u6301\u53c2\u6570\u7ed1\u5b9a&#xff0c;\u53ef\u4ee5\u9884\u7ed1\u5b9a\u90e8\u5206\u53c2\u6570\u751f\u6210\u65b0\u7684\u53ef\u8c03\u7528\u5bf9\u8c61&#xff0c;\u8ba9\u51fd\u6570\u5f0f\u7f16\u7a0b\u98ce\u683c\u66f4\u52a0\u7075\u6d3b\u3002<\/p>\n<h4>2.5 \u6a21\u677f\u4e0e\u6cdb\u578b\u7f16\u7a0b<\/h4>\n<p>C&#043;&#043;11 \u5f15\u5165\u4e86 \u53ef\u53d8\u53c2\u6570\u6a21\u677f&#xff0c;\u652f\u6301\u4efb\u610f\u6570\u91cf\u6a21\u677f\u53c2\u6570\u7684\u51fd\u6570\u548c\u7c7b&#xff0c;\u662f\u5b9e\u73b0\u5b8c\u7f8e\u8f6c\u53d1\u3001\u5143\u7ec4\u3001\u7c7b\u578b\u5b89\u5168 printf \u7b49\u9ad8\u7ea7\u6cdb\u578b\u6280\u672f\u7684\u57fa\u7840&#xff1b;extern template \u53ef\u4ee5\u663e\u5f0f\u5b9e\u4f8b\u5316\u6a21\u677f&#xff0c;\u51cf\u5c11\u7f16\u8bd1\u65f6\u95f4&#xff0c;\u907f\u514d\u540c\u4e00\u6a21\u677f\u5728\u591a\u4e2a\u7f16\u8bd1\u5355\u5143\u91cd\u590d\u5b9e\u4f8b\u5316&#xff1b;\u6a21\u677f\u522b\u540d&#xff08;using \u8bed\u6cd5&#xff09;\u8ba9\u6a21\u677f\u7c7b\u578b\u522b\u540d\u66f4\u6e05\u6670&#xff0c;\u4f8b\u5982 template&lt;typename T&gt; using Vec &#061; std::vector&lt;T&gt;;&#xff0c;\u6bd4 typedef \u66f4\u5f3a\u5927&#xff1b;\u9ed8\u8ba4\u6a21\u677f\u53c2\u6570 \u5141\u8bb8\u4e3a\u51fd\u6570\u6a21\u677f\u6307\u5b9a\u9ed8\u8ba4\u7c7b\u578b&#xff0c;\u8ba9\u8c03\u7528\u66f4\u7b80\u6d01\u3002<\/p>\n<h4>2.6 \u5e76\u53d1\u4e0e\u591a\u7ebf\u7a0b\u652f\u6301<\/h4>\n<p>C&#043;&#043;11 \u9996\u6b21\u5c06\u5e76\u53d1\u652f\u6301\u7eb3\u5165\u6807\u51c6\u5e93&#xff0c;\u63d0\u4f9b\u4e86 std::thread \u7528\u4e8e\u521b\u5efa\u548c\u7ba1\u7406\u7ebf\u7a0b&#xff0c;std::mutex \u7528\u4e8e\u4e92\u65a5\u9501\u4fdd\u62a4\u5171\u4eab\u6570\u636e&#xff0c;std::atomic \u63d0\u4f9b\u539f\u5b50\u64cd\u4f5c\u907f\u514d\u6570\u636e\u7ade\u4e89&#xff0c;std::condition_variable \u7528\u4e8e\u7ebf\u7a0b\u95f4\u540c\u6b65\u7b49\u5f85&#xff0c;\u4ee5\u53ca std::async\u3001std::future\u3001std::promise \u7b49\u5f02\u6b65\u4efb\u52a1\u673a\u5236&#xff0c;\u8ba9\u8de8\u5e73\u53f0\u591a\u7ebf\u7a0b\u7f16\u7a0b\u6210\u4e3a\u53ef\u80fd&#xff0c;\u65e0\u9700\u518d\u4f9d\u8d56\u64cd\u4f5c\u7cfb\u7edf\u7279\u5b9a\u7684\u7ebf\u7a0b API\u3002<\/p>\n<p>#include &lt;thread&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nvoid hello() {<br \/>\n    std::cout &lt;&lt; &#034;Hello from thread&#034; &lt;&lt; std::endl;<br \/>\n}<br \/>\nint main() {<br \/>\n    std::thread t(hello);<br \/>\n    t.join();<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u4f7f\u7528 std::thread \u65f6\u9700\u8981\u6ce8\u610f&#xff1a;\u7ebf\u7a0b\u5bf9\u8c61\u6790\u6784\u524d\u5fc5\u987b\u8c03\u7528 join() \u6216 detach()&#xff0c;\u5426\u5219\u4f1a\u89e6\u53d1 std::terminate\u3002std::async \u5219\u66f4\u9002\u5408\u9700\u8981\u8fd4\u56de\u503c\u6216\u5f02\u5e38\u4f20\u64ad\u7684\u5f02\u6b65\u4efb\u52a1\u573a\u666f\u3002<\/p>\n<h4>2.7 \u6807\u51c6\u5e93\u589e\u5f3a<\/h4>\n<p>C&#043;&#043;11 \u5bf9\u6807\u51c6\u5e93\u8fdb\u884c\u4e86\u5927\u5e45\u6269\u5145&#xff0c;\u65b0\u589e\u4e86 std::regex \u6b63\u5219\u8868\u8fbe\u5f0f\u5e93&#xff0c;\u652f\u6301 ECMAScript \u7b49\u591a\u79cd\u6b63\u5219\u8bed\u6cd5&#xff1b;std::random \u73b0\u4ee3\u968f\u673a\u6570\u5e93&#xff08;std::random_device\u3001std::mt19937 \u7b49&#xff09;&#xff0c;\u6bd4\u65e7\u7684 rand() \u66f4\u5747\u5300\u3001\u53ef\u590d\u73b0&#xff1b;std::chrono \u9ad8\u7cbe\u5ea6\u65f6\u95f4\u5e93&#xff0c;\u63d0\u4f9b\u7eb3\u79d2\u7ea7\u65f6\u95f4\u6d4b\u91cf\u548c\u65f6\u949f\u62bd\u8c61&#xff1b;std::tuple \u5143\u7ec4\u7c7b\u578b&#xff0c;\u53ef\u4ee5\u6253\u5305\u4efb\u610f\u6570\u91cf\u548c\u7c7b\u578b\u7684\u503c&#xff1b;std::unordered_map \u548c std::unordered_set \u54c8\u5e0c\u5bb9\u5668&#xff0c;\u5e73\u5747 O(1) \u67e5\u627e\u590d\u6742\u5ea6&#xff1b;\u4ee5\u53ca std::array \u5b9a\u957f\u6570\u7ec4\u5bb9\u5668&#xff0c;\u517c\u5177 C \u6570\u7ec4\u7684\u6027\u80fd\u548c STL \u5bb9\u5668\u7684\u63a5\u53e3\u3002<\/p>\n<h4>2.8 \u5176\u4ed6\u91cd\u8981\u7279\u6027<\/h4>\n<ul>\n<li>\u521d\u59cb\u5316\u5217\u8868&#xff1a;std::initializer_list \u652f\u6301\u7edf\u4e00\u7684\u521d\u59cb\u5316\u8bed\u6cd5&#xff0c;\u8ba9\u5bb9\u5668\u53ef\u4ee5\u7528\u82b1\u62ec\u53f7\u76f4\u63a5\u521d\u59cb\u5316&#xff0c;\u5982 std::vector&lt;int&gt; v &#061; {1, 2, 3};\u3002<\/li>\n<li>\u7edf\u4e00\u521d\u59cb\u5316&#xff1a;\u4f7f\u7528\u82b1\u62ec\u53f7 {} \u8fdb\u884c\u7edf\u4e00\u7684\u53d8\u91cf\u521d\u59cb\u5316&#xff0c;\u907f\u514d&#034;\u6700\u4ee4\u4eba\u5934\u75db\u7684\u89e3\u6790&#034;\u95ee\u9898&#xff0c;\u4e5f\u9632\u6b62\u7a84\u5316\u8f6c\u6362\u3002<\/li>\n<li>\u7c7b\u578b\u522b\u540d&#xff1a;using \u8bed\u6cd5\u53ef\u4ee5\u66ff\u4ee3 typedef&#xff0c;\u4e14\u652f\u6301\u6a21\u677f\u522b\u540d&#xff0c;\u53ef\u8bfb\u6027\u66f4\u597d\u3002<\/li>\n<li>\u5c5e\u6027&#xff1a;[[noreturn]]\u3001[[carries_dependency]] \u7b49\u6807\u51c6\u5c5e\u6027&#xff0c;\u4e3a\u7f16\u8bd1\u5668\u63d0\u4f9b\u4f18\u5316\u548c\u68c0\u67e5\u63d0\u793a\u3002<\/li>\n<li>\u539f\u59cb\u5b57\u7b26\u4e32\u5b57\u9762\u91cf&#xff1a;R&#034;(&#8230;)&#034; \u907f\u514d\u8f6c\u4e49\u5b57\u7b26\u7684\u56f0\u6270&#xff0c;\u7279\u522b\u9002\u5408\u4e66\u5199\u6b63\u5219\u8868\u8fbe\u5f0f\u548c\u8def\u5f84\u5b57\u7b26\u4e32\u3002<\/li>\n<li>\u7528\u6237\u81ea\u5b9a\u4e49\u5b57\u9762\u91cf&#xff1a;\u5141\u8bb8\u5b9a\u4e49\u5e26\u540e\u7f00\u7684\u5b57\u9762\u91cf\u8fd0\u7b97\u7b26&#xff0c;\u5982 100_km&#xff0c;\u8ba9\u4ee3\u7801\u66f4\u8bed\u4e49\u5316\u3002<\/li>\n<li>noexcept \u8bf4\u660e\u7b26&#xff1a;\u58f0\u660e\u51fd\u6570\u4e0d\u4f1a\u629b\u51fa\u5f02\u5e38&#xff0c;\u8ba9\u7f16\u8bd1\u5668\u53ef\u4ee5\u66f4\u597d\u5730\u4f18\u5316&#xff0c;\u5e76\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u5f02\u5e38\u5904\u7406\u5f00\u9500\u3002<\/li>\n<li>alignof \u548c alignas&#xff1a;\u67e5\u8be2\u548c\u63a7\u5236\u5185\u5b58\u5bf9\u9f50&#xff0c;\u5bf9\u5e95\u5c42\u6027\u80fd\u4f18\u5316\u548c\u786c\u4ef6\u4ea4\u4e92\u975e\u5e38\u91cd\u8981\u3002<\/li>\n<li>std::begin \/ std::end&#xff1a;\u7edf\u4e00\u5bb9\u5668\u548c\u6570\u7ec4\u7684\u904d\u5386\u63a5\u53e3&#xff0c;\u8ba9\u6cdb\u578b\u7b97\u6cd5\u53ef\u4ee5\u540c\u65f6\u4f5c\u7528\u4e8e\u6570\u7ec4\u548c STL \u5bb9\u5668\u3002<\/li>\n<li>std::to_string&#xff1a;\u6570\u503c\u8f6c\u5b57\u7b26\u4e32\u7684\u4fbf\u6377\u51fd\u6570&#xff0c;\u907f\u514d\u4f7f\u7528 stringstream \u7684\u7e41\u7410\u5199\u6cd5\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u901a\u8fc7\u51e0\u4e2a\u793a\u4f8b\u6f14\u793a\u8fd9\u4e9b\u7279\u6027\u7684\u5178\u578b\u7528\u6cd5\u3002<\/p>\n<p>#include &lt;vector&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nint main() {<br \/>\n\/\/ \u521d\u59cb\u5316\u5217\u8868 &#043; \u7edf\u4e00\u521d\u59cb\u5316<br \/>\nstd::vector&lt;int&gt; v &#061; {1, 2, 3};<br \/>\nint arr[]{4, 5, 6};          \/\/ \u82b1\u62ec\u53f7\u521d\u59cb\u5316&#xff0c;\u9632\u6b62\u7a84\u5316\u8f6c\u6362<br \/>\n\/\/ std::begin \/ std::end \u7edf\u4e00\u904d\u5386\u6570\u7ec4\u548c\u5bb9\u5668<br \/>\nfor (auto it &#061; std::begin(arr); it !&#061; std::end(arr); &#043;&#043;it) {<br \/>\n    std::cout &amp;lt;&amp;lt; *it &amp;lt;&amp;lt; &#034; &#034;;<br \/>\n}<br \/>\nstd::cout &amp;lt;&amp;lt; std::endl;<br \/>\n\/\/ std::to_string \u6570\u503c\u8f6c\u5b57\u7b26\u4e32<br \/>\nstd::string s &#061; std::to_string(42);<br \/>\nstd::cout &amp;lt;&amp;lt; s &amp;lt;&amp;lt; std::endl;<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n\/\/ \u7528\u6237\u81ea\u5b9a\u4e49\u5b57\u9762\u91cf&#xff1a;\u5b9a\u4e49\u5343\u7c73\u540e\u7f00<br \/>\nlong double operator&#034;&#034; _km(long double val) {<br \/>\nreturn val * 1000.0;   \/\/ \u8f6c\u6362\u4e3a\u7c73<br \/>\n}<br \/>\n\/\/ noexcept \u8bf4\u660e\u7b26&#xff1a;\u58f0\u660e\u51fd\u6570\u4e0d\u629b\u5f02\u5e38<br \/>\nint divide(int a, int b) noexcept {<br \/>\nreturn a \/ b;<br \/>\n}<br \/>\nint main() {<br \/>\nauto dist &#061; 100.0_km;   \/\/ 100 \u5343\u7c73<br \/>\nstd::cout &lt;&lt; dist &lt;&lt; &#034; meters&#034; &lt;&lt; std::endl;<br \/>\n\/\/ \u539f\u59cb\u5b57\u7b26\u4e32\u5b57\u9762\u91cf&#xff1a;\u65e0\u9700\u8f6c\u4e49<br \/>\nconst char* path &#061; R&#034;(C:\\\\Users\\\\name\\\\file.txt)&#034;;<br \/>\nstd::cout &amp;lt;&amp;lt; path &amp;lt;&amp;lt; std::endl;<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;iostream&gt;<\/p>\n<p>\/\/ alignas \u63a7\u5236\u5bf9\u9f50&#xff0c;alignof \u67e5\u8be2\u5bf9\u9f50<br \/>\nstruct alignas(16) AlignedData {<br \/>\n    char data[16];<br \/>\n};<\/p>\n<p>int main() {<br \/>\n    std::cout &lt;&lt; &#034;alignof(AlignedData) &#061; &#034; &lt;&lt; alignof(AlignedData) &lt;&lt; std::endl;<\/p>\n<p>    \/\/ [[noreturn]] \u5c5e\u6027&#xff1a;\u6807\u8bb0\u4e0d\u8fd4\u56de\u7684\u51fd\u6570<br \/>\n    [[noreturn]] void fail() {<br \/>\n        throw std::runtime_error(&#034;fatal error&#034;);<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<h3>3. C&#043;&#043;14\u7279\u6027<\/h3>\n<p>C&#043;&#043;14 \u662f\u5bf9 C&#043;&#043;11 \u7684\u8865\u5145\u548c\u5b8c\u5584&#xff0c;\u6539\u52a8\u76f8\u5bf9\u8f83\u5c0f&#xff0c;\u4f46\u63d0\u5347\u4e86\u6613\u7528\u6027\u3002<\/p>\n<ul>\n<li>\u6cdb\u578b Lambda&#xff1a;Lambda \u53c2\u6570\u53ef\u4ee5\u4f7f\u7528 auto&#xff0c;\u5b9e\u73b0\u6a21\u677f\u5316\u3002\u540c\u4e00\u4e2a Lambda \u65e2\u53ef\u4ee5\u7528\u4e8e int \u4e5f\u53ef\u4ee5\u7528\u4e8e double\u3002<\/li>\n<\/ul>\n<p>auto add &#061; [](auto a, auto b) { return a &#043; b; };<\/p>\n<ul>\n<li>\u8fd4\u56de\u7c7b\u578b\u63a8\u5bfc&#xff1a;\u666e\u901a\u51fd\u6570\u53ef\u4ee5\u4f7f\u7528 auto \u63a8\u5bfc\u8fd4\u56de\u7c7b\u578b\u3002\u7f16\u8bd1\u5668\u4f1a\u81ea\u52a8\u63a8\u5bfc\u8fd4\u56de\u7c7b\u578b\u4e3a int\u3002<\/li>\n<\/ul>\n<p>auto square(int x) { return x * x; }<\/p>\n<ul>\n<li>\u53d8\u91cf\u6a21\u677f&#xff1a;\u652f\u6301\u6a21\u677f\u5316\u7684\u53d8\u91cf\u58f0\u660e\u3002\u4f7f\u7528\u65f6 pi&lt;float&gt; \u548c pi&lt;double&gt; \u4f1a\u5f97\u5230\u4e0d\u540c\u7cbe\u5ea6\u7684\u5706\u5468\u7387\u3002<\/li>\n<\/ul>\n<p>template&lt;typename T&gt; constexpr T pi &#061; T(3.1415926535897932385);<\/p>\n<ul>\n<li>constexpr \u589e\u5f3a&#xff1a;\u653e\u5bbd\u4e86 constexpr \u51fd\u6570\u7684\u9650\u5236&#xff0c;\u652f\u6301\u5faa\u73af\u548c\u5c40\u90e8\u53d8\u91cf\u3002\u4e0b\u9762\u7684\u51fd\u6570\u53ef\u4ee5\u5728\u7f16\u8bd1\u671f\u8ba1\u7b97\u9636\u4e58\u3002<\/li>\n<\/ul>\n<p>constexpr int factorial(int n) {<br \/>\n    int result &#061; 1;<br \/>\n    for (int i &#061; 2; i &lt;&#061; n; &#043;&#043;i) result *&#061; i;<br \/>\n    return result;<br \/>\n}<\/p>\n<ul>\n<li>\u4e8c\u8fdb\u5236\u5b57\u9762\u91cf&#xff1a;\u4f7f\u7528 0b \u524d\u7f00\u8868\u793a\u4e8c\u8fdb\u5236\u6570\u3002\u4f8b\u5982 int mask &#061; 0b101010; \u7b49\u4ef7\u4e8e\u5341\u8fdb\u5236\u7684 42\u3002<\/li>\n<li>\u6570\u5b57\u5206\u9694\u7b26&#xff1a;\u4f7f\u7528\u5355\u5f15\u53f7\u5206\u9694\u6570\u5b57&#xff0c;\u63d0\u5347\u53ef\u8bfb\u6027&#xff0c;\u5982 1&#039;000&#039;000 \u8868\u793a\u4e00\u767e\u4e07&#xff0c;0b1010&#039;1100 \u8ba9\u4e8c\u8fdb\u5236\u5206\u7ec4\u66f4\u6e05\u6670\u3002<\/li>\n<li>std::make_unique&#xff1a;\u6807\u51c6\u5e93\u65b0\u589e make_unique \u5de5\u5382\u51fd\u6570&#xff0c;\u4e0e C&#043;&#043;11 \u7684 make_shared \u5bf9\u5e94&#xff0c;\u907f\u514d\u76f4\u63a5\u4f7f\u7528 new\u3002<\/li>\n<\/ul>\n<p>auto p &#061; std::make_unique&lt;int&gt;(42);<\/p>\n<ul>\n<li>[[deprecated]] \u5c5e\u6027&#xff1a;\u6807\u8bb0\u5df2\u5f03\u7528\u7684\u4ee3\u7801\u3002\u8c03\u7528 old_func \u65f6\u7f16\u8bd1\u5668\u4f1a\u7ed9\u51fa\u8b66\u544a\u63d0\u793a\u3002<\/li>\n<\/ul>\n<p>[[deprecated(&#034;use new_func instead&#034;)]] void old_func();<\/p>\n<h3>4. C&#043;&#043;17\u7279\u6027<\/h3>\n<p>C&#043;&#043;17 \u5728 C&#043;&#043;14 \u7684\u57fa\u7840\u4e0a\u7ee7\u7eed\u63a8\u8fdb&#xff0c;\u8fdb\u4e00\u6b65\u7b80\u5316\u8bed\u6cd5\u3001\u589e\u5f3a\u6807\u51c6\u5e93&#xff0c;\u5e76\u5f15\u5165\u4e86\u4e00\u4e9b\u91cd\u8981\u7684\u65b0\u80fd\u529b\u3002\u4e0b\u9762\u4ece\u8bed\u8a00\u7279\u6027\u548c\u6807\u51c6\u5e93\u4e24\u4e2a\u7ef4\u5ea6\u8fdb\u884c\u68b3\u7406\u3002<\/p>\n<h4>4.1 \u7ed3\u6784\u5316\u7ed1\u5b9a<\/h4>\n<p>\u7ed3\u6784\u5316\u7ed1\u5b9a&#xff08;structured bindings&#xff09;\u5141\u8bb8\u5c06\u6570\u7ec4\u3001\u5143\u7ec4\u6216\u7ed3\u6784\u4f53\u7684\u6210\u5458\u4e00\u6b21\u6027\u89e3\u5305\u5230\u591a\u4e2a\u53d8\u91cf\u4e2d&#xff0c;\u8ba9\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u76f4\u89c2\u3002\u4f8b\u5982&#xff0c;\u4ece std::map \u4e2d\u904d\u5386\u952e\u503c\u5bf9\u65f6&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u7528 auto [key, value] \u89e3\u5305\u3002<\/p>\n<p>#include &lt;map&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nstd::map&lt;std::string, int&gt; scores &#061; {{&#034;Alice&#034;, 90}, {&#034;Bob&#034;, 85}};<br \/>\nfor (const auto&amp; [name, score] : scores) {<br \/>\n    std::cout &lt;&lt; name &lt;&lt; &#034;: &#034; &lt;&lt; score &lt;&lt; std::endl;<br \/>\n}<\/p>\n<h4>4.2 if\/switch\u8bed\u53e5<\/h4>\n<p>C&#043;&#043;17 \u5141\u8bb8\u5728 if \u548c switch \u8bed\u53e5\u4e2d\u76f4\u63a5\u58f0\u660e\u521d\u59cb\u5316\u53d8\u91cf&#xff0c;\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u88ab\u9650\u5236\u5728\u8bed\u53e5\u5757\u5185&#xff0c;\u907f\u514d\u6c61\u67d3\u5916\u90e8\u4f5c\u7528\u57df&#xff0c;\u4e5f\u8ba9\u6761\u4ef6\u5224\u65ad\u4e0e\u53d8\u91cf\u58f0\u660e\u66f4\u52a0\u7d27\u51d1\u3002<\/p>\n<p>if (auto it &#061; container.find(key); it !&#061; container.end()) {<br \/>\n    \/\/ \u4f7f\u7528 it<br \/>\n} else {<br \/>\n    \/\/ \u672a\u627e\u5230<br \/>\n}<\/p>\n<h4>4.3 \u5185\u8054\u53d8\u91cf<\/h4>\n<p>\u5185\u8054\u53d8\u91cf&#xff08;inline variable&#xff09;\u5141\u8bb8\u5728\u5934\u6587\u4ef6\u4e2d\u5b9a\u4e49\u53d8\u91cf\u800c\u4e0d\u4f1a\u5f15\u53d1\u591a\u91cd\u5b9a\u4e49\u9519\u8bef&#xff0c;\u89e3\u51b3\u4e86 C&#043;&#043; \u4e2d\u5934\u6587\u4ef6\u5b9a\u4e49\u5168\u5c40\u53d8\u91cf\u7684\u957f\u671f\u75db\u70b9&#xff0c;\u5c24\u5176\u9002\u5408\u6a21\u677f\u548c\u5934\u6587\u4ef6\u5e93\u7684\u5f00\u53d1\u3002<\/p>\n<p>\/\/ \u5934\u6587\u4ef6\u4e2d\u5b9a\u4e49<br \/>\ninline int global_counter &#061; 0;<\/p>\n<h4>4.4 \u6298\u53e0\u8868\u8fbe\u5f0f<\/h4>\n<p>\u6298\u53e0\u8868\u8fbe\u5f0f&#xff08;fold expressions&#xff09;\u8ba9\u53ef\u53d8\u53c2\u6570\u6a21\u677f\u7684\u5c55\u5f00\u66f4\u52a0\u7b80\u6d01&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u5bf9\u53c2\u6570\u5305\u8fdb\u884c\u4e00\u5143\u6216\u4e8c\u5143\u8fd0\u7b97&#xff0c;\u5927\u5e45\u7b80\u5316\u4e86\u9012\u5f52\u5c55\u5f00\u7684\u5199\u6cd5\u3002<\/p>\n<p>template&lt;typename&#8230; Args&gt;<br \/>\nauto sum(Args&#8230; args) {<br \/>\n    return (args &#043; &#8230;);  \/\/ \u4e00\u5143\u53f3\u6298\u53e0<br \/>\n}<\/p>\n<h4>4.5 \u6807\u51c6\u5e93\u65b0\u589e<\/h4>\n<ul>\n<li>std::optional&#xff1a;\u8868\u793a\u53ef\u80fd\u5b58\u5728\u7684\u503c&#xff0c;\u907f\u514d\u4f7f\u7528\u54e8\u5175\u503c\u6216\u6307\u9488\u8868\u793a&#034;\u65e0\u503c&#034;\u72b6\u6001&#xff0c;\u8ba9\u4ee3\u7801\u66f4\u5b89\u5168\u3001\u8bed\u4e49\u66f4\u6e05\u6670\u3002<\/li>\n<li>std::variant&#xff1a;\u7c7b\u578b\u5b89\u5168\u7684\u8054\u5408\u4f53&#xff0c;\u53ef\u4ee5\u5b58\u50a8\u591a\u79cd\u7c7b\u578b\u4e2d\u7684\u4e00\u79cd&#xff0c;\u914d\u5408 std::visit \u4f7f\u7528\u975e\u5e38\u7075\u6d3b\u3002<\/li>\n<li>std::any&#xff1a;\u53ef\u4ee5\u5b58\u50a8\u4efb\u610f\u7c7b\u578b\u7684\u503c&#xff0c;\u9002\u5408\u9700\u8981\u52a8\u6001\u7c7b\u578b\u5b58\u50a8\u7684\u573a\u666f\u3002<\/li>\n<li>std::string_view&#xff1a;\u975e\u62e5\u6709\u5f0f\u7684\u5b57\u7b26\u4e32\u89c6\u56fe&#xff0c;\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u62f7\u8d1d&#xff0c;\u63d0\u5347\u5b57\u7b26\u4e32\u5904\u7406\u6027\u80fd\u3002<\/li>\n<li>std::filesystem&#xff1a;\u6807\u51c6\u5316\u7684\u6587\u4ef6\u7cfb\u7edf\u5e93&#xff0c;\u63d0\u4f9b\u8de8\u5e73\u53f0\u7684\u8def\u5f84\u3001\u76ee\u5f55\u548c\u6587\u4ef6\u64cd\u4f5c\u63a5\u53e3\u3002<\/li>\n<li>\u5e76\u884c\u7b97\u6cd5&#xff1a;\u6807\u51c6\u5e93\u7b97\u6cd5\u652f\u6301\u6267\u884c\u7b56\u7565&#xff08;\u5982 std::execution::par&#xff09;&#xff0c;\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u5e76\u884c\u5316\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u901a\u8fc7\u51e0\u4e2a\u793a\u4f8b\u6f14\u793a\u8fd9\u4e9b\u65b0\u589e\u6807\u51c6\u5e93\u7ec4\u4ef6\u7684\u5178\u578b\u7528\u6cd5\u3002<\/p>\n<p>#include &lt;optional&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nstd::optional&lt;int&gt; divide(int a, int b) {<br \/>\nif (b &#061;&#061; 0) return std::nullopt;<br \/>\nreturn a \/ b;<br \/>\n}<br \/>\nint main() {<br \/>\nauto result &#061; divide(10, 2);<br \/>\nif (result) {<br \/>\nstd::cout &lt;&lt; &#034;result: &#034; &lt;&lt; *result &lt;&lt; std::endl;<br \/>\n} else {<br \/>\nstd::cout &lt;&lt; &#034;division by zero&#034; &lt;&lt; std::endl;<br \/>\n}<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;variant&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nint main() {<br \/>\nstd::variant&lt;int, double, std::string&gt; v;<br \/>\nv &#061; 42;<br \/>\nstd::cout &lt;&lt; std::get&lt;int&gt;(v) &lt;&lt; std::endl;<br \/>\nv &#061; &#034;hello&#034;;<br \/>\nstd::visit([](auto&amp;amp;&amp;amp; arg) {<br \/>\n    std::cout &amp;lt;&amp;lt; arg &amp;lt;&amp;lt; std::endl;<br \/>\n}, v);<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;any&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nint main() {<br \/>\nstd::any value &#061; 42;<br \/>\nstd::cout &lt;&lt; std::any_cast&lt;int&gt;(value) &lt;&lt; std::endl;<br \/>\nvalue &#061; std::string(&#034;hello&#034;);<br \/>\nstd::cout &amp;lt;&amp;lt; std::any_cast&amp;lt;std::string&amp;gt;(value) &amp;lt;&amp;lt; std::endl;<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;string_view&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nvoid print(std::string_view sv) {<br \/>\nstd::cout &lt;&lt; sv &lt;&lt; std::endl;<br \/>\n}<br \/>\nint main() {<br \/>\nstd::string s &#061; &#034;hello world&#034;;<br \/>\nprint(s);                       \/\/ \u4ece std::string \u9690\u5f0f\u8f6c\u6362<br \/>\nprint(&#034;literal&#034;);               \/\/ \u4ece\u5b57\u7b26\u4e32\u5b57\u9762\u91cf\u6784\u9020<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;filesystem&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nnamespace fs &#061; std::filesystem;<br \/>\nint main() {<br \/>\nfs::path p &#061; &#034;example.txt&#034;;<br \/>\nstd::cout &lt;&lt; &#034;exists: &#034; &lt;&lt; fs::exists(p) &lt;&lt; std::endl;<br \/>\nstd::cout &lt;&lt; &#034;extension: &#034; &lt;&lt; p.extension() &lt;&lt; std::endl;<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;vector&gt;<br \/>\n#include &lt;algorithm&gt;<br \/>\n#include &lt;execution&gt;<br \/>\n#include &lt;iostream&gt;<\/p>\n<p>int main() {<br \/>\n    std::vector&lt;int&gt; v &#061; {5, 2, 8, 1, 9, 3};<br \/>\n    std::sort(std::execution::par, v.begin(), v.end());<br \/>\n    for (int x : v) {<br \/>\n        std::cout &lt;&lt; x &lt;&lt; &#034; &#034;;<br \/>\n    }<br \/>\n    std::cout &lt;&lt; std::endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<h3>5. C&#043;&#043;20\u7279\u6027<\/h3>\n<p>C&#043;&#043;20 \u88ab\u79f0\u4e3a\u4e00\u6b21&#034;\u5927\u7248\u672c&#034;\u66f4\u65b0&#xff0c;\u5f15\u5165\u4e86\u6982\u5ff5\u3001\u534f\u7a0b\u3001\u8303\u56f4\u7b49\u91cd\u91cf\u7ea7\u7279\u6027&#xff0c;\u8fdb\u4e00\u6b65\u63d0\u5347\u4e86 C&#043;&#043; \u7684\u8868\u8fbe\u80fd\u529b\u548c\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<h4>5.1 \u6982\u5ff5&#xff08;Concepts&#xff09;<\/h4>\n<p>\u6982\u5ff5&#xff08;concepts&#xff09;\u5141\u8bb8\u4e3a\u6a21\u677f\u53c2\u6570\u5b9a\u4e49\u7ea6\u675f\u6761\u4ef6&#xff0c;\u8ba9\u6a21\u677f\u9519\u8bef\u4fe1\u606f\u66f4\u6e05\u6670&#xff0c;\u4e5f\u8ba9\u6cdb\u578b\u4ee3\u7801\u7684\u610f\u56fe\u66f4\u52a0\u660e\u786e\u3002\u4f8b\u5982&#xff0c;\u53ef\u4ee5\u7ea6\u675f\u6a21\u677f\u53c2\u6570\u5fc5\u987b\u652f\u6301\u67d0\u79cd\u8fd0\u7b97\u3002<\/p>\n<p>#include &lt;concepts&gt;<br \/>\ntemplate&lt;typename T&gt;<br \/>\nrequires std::integral&lt;T&gt;<br \/>\nT add(T a, T b) {<br \/>\n    return a &#043; b;<br \/>\n}<\/p>\n<h4>5.2 \u534f\u7a0b&#xff08;Coroutines&#xff09;<\/h4>\n<p>\u534f\u7a0b&#xff08;coroutines&#xff09;\u662f C&#043;&#043;20 \u5f15\u5165\u7684\u5f02\u6b65\u7f16\u7a0b\u5229\u5668&#xff0c;\u5141\u8bb8\u51fd\u6570\u5728\u4e2d\u95f4\u6302\u8d77\u548c\u6062\u590d&#xff0c;\u8ba9\u5f02\u6b65\u4ee3\u7801\u53ef\u4ee5\u50cf\u540c\u6b65\u4ee3\u7801\u4e00\u6837\u7f16\u5199&#xff0c;\u6781\u5927\u7b80\u5316\u4e86\u5f02\u6b65\u6d41\u7a0b\u7684\u63a7\u5236\u3002<\/p>\n<p>#include &lt;coroutine&gt;<br \/>\n\/\/ \u534f\u7a0b\u793a\u4f8b&#xff08;\u7b80\u5316&#xff09;<br \/>\ngenerator&lt;int&gt; counter() {<br \/>\n    for (int i &#061; 0; i &lt; 10; &#043;&#043;i) {<br \/>\n        co_yield i;<br \/>\n    }<br \/>\n}<\/p>\n<h4>5.3 \u8303\u56f4&#xff08;Ranges&#xff09;<\/h4>\n<p>\u8303\u56f4&#xff08;ranges&#xff09;\u5e93\u63d0\u4f9b\u4e86\u4e00\u5957\u7ec4\u5408\u5f0f\u3001\u60f0\u6027\u6c42\u503c\u7684\u7b97\u6cd5\u63a5\u53e3&#xff0c;\u8ba9\u6570\u636e\u7ba1\u9053\u7684\u5199\u6cd5\u66f4\u52a0\u4f18\u96c5\u3002\u914d\u5408\u89c6\u56fe&#xff08;views&#xff09;\u53ef\u4ee5\u5b9e\u73b0\u94fe\u5f0f\u64cd\u4f5c&#xff0c;\u907f\u514d\u4e2d\u95f4\u5bb9\u5668\u7684\u521b\u5efa\u3002<\/p>\n<p>#include &lt;ranges&gt;<br \/>\n#include &lt;vector&gt;<br \/>\nstd::vector&lt;int&gt; v &#061; {1, 2, 3, 4, 5, 6};<br \/>\nauto even_squares &#061; v | std::views::filter([](int x) { return x % 2 &#061;&#061; 0; })<br \/>\n                      | std::views::transform([](int x) { return x * x; });<\/p>\n<h4>5.4 \u5176\u4ed6\u91cd\u8981\u7279\u6027<\/h4>\n<ul>\n<li>\u4e09\u8def\u6bd4\u8f83\u8fd0\u7b97\u7b26&#xff08;&lt;&#061;&gt;&#xff09;&#xff1a;\u81ea\u52a8\u751f\u6210\u6240\u6709\u6bd4\u8f83\u8fd0\u7b97\u7b26&#xff0c;\u7b80\u5316\u81ea\u5b9a\u4e49\u7c7b\u578b\u7684\u6bd4\u8f83\u903b\u8f91\u3002<\/li>\n<li>constexpr \u589e\u5f3a&#xff1a;\u652f\u6301 constexpr \u5bb9\u5668\u3001constexpr \u865a\u51fd\u6570\u7b49&#xff0c;\u8ba9\u66f4\u591a\u4ee3\u7801\u53ef\u4ee5\u5728\u7f16\u8bd1\u671f\u6c42\u503c\u3002<\/li>\n<li>std::span&#xff1a;\u975e\u62e5\u6709\u5f0f\u7684\u8fde\u7eed\u5185\u5b58\u89c6\u56fe&#xff0c;\u7c7b\u4f3c string_view \u4f46\u9002\u7528\u4e8e\u4efb\u610f\u6570\u7ec4\u7c7b\u578b\u3002<\/li>\n<li>std::jthread&#xff1a;\u53ef\u81ea\u52a8 join \u7684\u7ebf\u7a0b\u7c7b&#xff0c;\u6790\u6784\u65f6\u81ea\u52a8\u7b49\u5f85\u7ebf\u7a0b\u7ed3\u675f&#xff0c;\u907f\u514d\u5fd8\u8bb0 join \u7684\u95ee\u9898\u3002<\/li>\n<li>\u6a21\u5757&#xff08;Modules&#xff09;&#xff1a;\u65b0\u7684\u6a21\u5757\u5316\u7f16\u8bd1\u673a\u5236&#xff0c;\u65e8\u5728\u66ff\u4ee3\u4f20\u7edf\u7684\u5934\u6587\u4ef6\u5305\u542b\u65b9\u5f0f&#xff0c;\u63d0\u5347\u7f16\u8bd1\u901f\u5ea6\u548c\u5c01\u88c5\u6027\u3002<\/li>\n<li>\u6307\u5b9a\u521d\u59cb\u5316\u5668&#xff1a;\u5141\u8bb8\u6309\u6210\u5458\u540d\u521d\u59cb\u5316\u805a\u5408\u7c7b\u578b&#xff0c;\u8ba9\u7ed3\u6784\u4f53\u521d\u59cb\u5316\u66f4\u6e05\u6670\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u901a\u8fc7\u51e0\u4e2a\u793a\u4f8b\u6f14\u793a\u8fd9\u4e9b\u7279\u6027\u7684\u5178\u578b\u7528\u6cd5\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;compare&gt;<br \/>\nstruct Point {<br \/>\nint x, y;<br \/>\nauto operator&lt;&#061;&gt;(const Point&amp; other) const &#061; default;<br \/>\n};<br \/>\nint main() {<br \/>\nPoint a{1, 2}, b{1, 3};<br \/>\nstd::cout &lt;&lt; (a &lt; b) &lt;&lt; std::endl;   \/\/ 1<br \/>\nstd::cout &lt;&lt; (a &#061;&#061; b) &lt;&lt; std::endl;  \/\/ 0<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;span&gt;<br \/>\n#include &lt;vector&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nvoid print_sum(std::span&lt;const int&gt; data) {<br \/>\nint sum &#061; 0;<br \/>\nfor (int v : data) sum &#043;&#061; v;<br \/>\nstd::cout &lt;&lt; &#034;sum: &#034; &lt;&lt; sum &lt;&lt; std::endl;<br \/>\n}<br \/>\nint main() {<br \/>\nstd::vector&lt;int&gt; vec &#061; {1, 2, 3, 4, 5};<br \/>\nint arr[] &#061; {10, 20, 30};<br \/>\nprint_sum(vec);   \/\/ \u5bb9\u5668<br \/>\nprint_sum(arr);   \/\/ \u539f\u751f\u6570\u7ec4<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>#include &lt;thread&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\nint main() {<br \/>\nstd::jthread t([] {<br \/>\nstd::cout &lt;&lt; &#034;Hello from jthread&#034; &lt;&lt; std::endl;<br \/>\n});<br \/>\n\/\/ \u6790\u6784\u65f6\u81ea\u52a8 join&#xff0c;\u65e0\u9700\u624b\u52a8\u8c03\u7528 t.join()<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p>struct Config {<br \/>\n    int width &#061; 800;<br \/>\n    int height &#061; 600;<br \/>\n    std::string title &#061; &#034;default&#034;;<br \/>\n};<br \/>\nConfig cfg &#061; {<br \/>\n.title &#061; &#034;My App&#034;,<br \/>\n.width &#061; 1024<br \/>\n};<\/p>\n<h3>6. \u5404\u7248\u672c\u6838\u5fc3\u7279\u6027\u5bf9\u6bd4<\/h3>\n<\/p>\n<p>\u4e3a\u4e86\u5e2e\u52a9\u8bfb\u8005\u5feb\u901f\u628a\u63e1 C&#043;&#043;11\u3001C&#043;&#043;14\u3001C&#043;&#043;17 \u548c C&#043;&#043;20 \u56db\u4e2a\u6807\u51c6\u7248\u672c\u4e4b\u95f4\u7684\u5dee\u5f02&#xff0c;\u4e0b\u9762\u7528\u4e00\u5f20\u8868\u683c\u5bf9\u6bd4\u5b83\u4eec\u7684\u53d1\u5e03\u65f6\u95f4\u3001\u6838\u5fc3\u7279\u6027\u4e0e\u5178\u578b\u5e94\u7528\u573a\u666f\u3002<\/p>\n<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:100%\">\n<tr>\u6807\u51c6\u7248\u672c\u53d1\u5e03\u65f6\u95f4\u6838\u5fc3\u7279\u6027\u5178\u578b\u5e94\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>C&#043;&#043;11<\/td>\n<td>2011 \u5e74<\/td>\n<td>auto \u7c7b\u578b\u63a8\u5bfc\u3001\u667a\u80fd\u6307\u9488\u3001\u79fb\u52a8\u8bed\u4e49\u4e0e\u53f3\u503c\u5f15\u7528\u3001Lambda \u8868\u8fbe\u5f0f\u3001\u8303\u56f4 for \u5faa\u73af\u3001nullptr\u3001constexpr\u3001\u5f3a\u7c7b\u578b\u679a\u4e3e\u3001\u53ef\u53d8\u53c2\u6570\u6a21\u677f\u3001std::thread \u5e76\u53d1\u652f\u6301\u3001std::regex\u3001std::chrono<\/td>\n<td>\u73b0\u4ee3 C&#043;&#043; \u57fa\u7840\u91cd\u6784\u3001\u8d44\u6e90\u5b89\u5168\u7ba1\u7406\u3001\u9ad8\u6027\u80fd\u5bb9\u5668\u4e0e\u5b57\u7b26\u4e32\u5904\u7406\u3001\u8de8\u5e73\u53f0\u591a\u7ebf\u7a0b\u7f16\u7a0b\u3001\u6b63\u5219\u4e0e\u65f6\u95f4\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>C&#043;&#043;14<\/td>\n<td>2014 \u5e74<\/td>\n<td>\u6cdb\u578b Lambda\u3001\u8fd4\u56de\u7c7b\u578b\u63a8\u5bfc\u3001\u53d8\u91cf\u6a21\u677f\u3001constexpr \u589e\u5f3a&#xff08;\u652f\u6301\u5faa\u73af\u4e0e\u5c40\u90e8\u53d8\u91cf&#xff09;\u3001\u4e8c\u8fdb\u5236\u5b57\u9762\u91cf\u3001\u6570\u5b57\u5206\u9694\u7b26\u3001std::make_unique\u3001[[deprecated]] \u5c5e\u6027<\/td>\n<td>\u5bf9 C&#043;&#043;11 \u4ee3\u7801\u7684\u6613\u7528\u6027\u4f18\u5316\u3001\u6a21\u677f\u5143\u7f16\u7a0b\u7b80\u5316\u3001\u7f16\u8bd1\u671f\u8ba1\u7b97\u589e\u5f3a\u3001\u4ee3\u7801\u5f03\u7528\u6807\u8bb0<\/td>\n<\/tr>\n<tr>\n<td>C&#043;&#043;17<\/td>\n<td>2017 \u5e74<\/td>\n<td>\u7ed3\u6784\u5316\u7ed1\u5b9a\u3001if\/switch \u521d\u59cb\u5316\u8bed\u53e5\u3001\u5185\u8054\u53d8\u91cf\u3001\u6298\u53e0\u8868\u8fbe\u5f0f\u3001std::optional\u3001std::variant\u3001std::any\u3001std::string_view\u3001std::filesystem\u3001\u5e76\u884c\u7b97\u6cd5<\/td>\n<td>\u66f4\u7b80\u6d01\u7684\u8bed\u6cd5\u8868\u8fbe\u3001\u7c7b\u578b\u5b89\u5168\u7684\u53ef\u9009\u503c\u4e0e\u591a\u6001\u5b58\u50a8\u3001\u96f6\u62f7\u8d1d\u5b57\u7b26\u4e32\u5904\u7406\u3001\u8de8\u5e73\u53f0\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\u3001\u6570\u636e\u5e76\u884c\u8ba1\u7b97<\/td>\n<\/tr>\n<tr>\n<td>C&#043;&#043;20<\/td>\n<td>2020 \u5e74<\/td>\n<td>\u6982\u5ff5&#xff08;Concepts&#xff09;\u3001\u534f\u7a0b&#xff08;Coroutines&#xff09;\u3001\u8303\u56f4&#xff08;Ranges&#xff09;\u3001\u4e09\u8def\u6bd4\u8f83\u8fd0\u7b97\u7b26\u3001constexpr \u589e\u5f3a\u3001std::span\u3001std::jthread\u3001\u6a21\u5757&#xff08;Modules&#xff09;\u3001\u6307\u5b9a\u521d\u59cb\u5316\u5668<\/td>\n<td>\u6cdb\u578b\u7ea6\u675f\u4e0e\u9519\u8bef\u4fe1\u606f\u4f18\u5316\u3001\u5f02\u6b65\u4e0e\u5e76\u53d1\u7f16\u7a0b\u3001\u60f0\u6027\u6570\u636e\u7ba1\u9053\u5904\u7406\u3001\u7f16\u8bd1\u671f\u8ba1\u7b97\u6269\u5c55\u3001\u6a21\u5757\u5316\u5927\u578b\u9879\u76ee\u6784\u5efa<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ece\u8868\u4e2d\u53ef\u4ee5\u770b\u51fa&#xff0c;C&#043;&#043;11 \u5960\u5b9a\u4e86\u73b0\u4ee3 C&#043;&#043; \u7684\u57fa\u77f3&#xff0c;C&#043;&#043;14 \u4e0e C&#043;&#043;17 \u9010\u6b65\u5b8c\u5584\u8bed\u6cd5\u548c\u6807\u51c6\u5e93&#xff0c;\u800c C&#043;&#043;20 \u5219\u5e26\u6765\u4e86\u6982\u5ff5\u3001\u534f\u7a0b\u3001\u8303\u56f4\u7b49\u91cd\u91cf\u7ea7\u80fd\u529b&#xff0c;\u63a8\u52a8 C&#043;&#043; \u5411\u66f4\u5b89\u5168\u3001\u66f4\u9ad8\u6548\u3001\u66f4\u6613\u7528\u7684\u65b9\u5411\u6301\u7eed\u6f14\u8fdb\u3002<\/p>\n<h3>7. \u603b\u7ed3<\/h3>\n<p>\u4ece C&#043;&#043;11 \u5230 C&#043;&#043;20&#xff0c;C&#043;&#043; \u8bed\u8a00\u7ecf\u5386\u4e86\u4ece&#034;\u4f20\u7edf\u7cfb\u7edf\u7ea7\u8bed\u8a00&#034;\u5230&#034;\u73b0\u4ee3\u3001\u5b89\u5168\u3001\u9ad8\u6548&#034;\u7684\u6df1\u523b\u53d8\u9769\u3002C&#043;&#043;11 \u5960\u5b9a\u4e86\u73b0\u4ee3 C&#043;&#043; \u7684\u57fa\u7840&#xff0c;\u5f15\u5165\u4e86\u667a\u80fd\u6307\u9488\u3001\u79fb\u52a8\u8bed\u4e49\u3001Lambda \u7b49\u6838\u5fc3\u7279\u6027&#xff1b;C&#043;&#043;14 \u505a\u4e86\u8865\u5145\u5b8c\u5584&#xff1b;C&#043;&#043;17 \u8fdb\u4e00\u6b65\u7b80\u5316\u8bed\u6cd5\u5e76\u589e\u5f3a\u6807\u51c6\u5e93&#xff1b;C&#043;&#043;20 \u5219\u5e26\u6765\u4e86\u6982\u5ff5\u3001\u534f\u7a0b\u3001\u8303\u56f4\u7b49\u91cd\u91cf\u7ea7\u80fd\u529b\u3002\u638c\u63e1\u8fd9\u4e9b\u65b0\u7279\u6027&#xff0c;\u4e0d\u4ec5\u80fd\u5199\u51fa\u66f4\u5b89\u5168\u3001\u66f4\u9ad8\u6548\u7684\u4ee3\u7801&#xff0c;\u4e5f\u80fd\u66f4\u597d\u5730\u7406\u89e3\u73b0\u4ee3 C&#043;&#043; \u751f\u6001\u7684\u53d1\u5c55\u65b9\u5411\u3002\u5efa\u8bae\u8bfb\u8005\u7ed3\u5408\u5b98\u65b9\u6587\u6863\u548c\u5b9e\u9645\u9879\u76ee&#xff0c;\u9010\u6b65\u5c06\u8fd9\u4e9b\u7279\u6027\u5e94\u7528\u5230\u65e5\u5e38\u5f00\u53d1\u4e2d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u5f15\u8a00C \u8bed\u8a00\u5728\u957f\u671f\u6f14\u8fdb\u8fc7\u7a0b\u4e2d&#xff0c;\u6bcf\u9694\u6570\u5e74\u4fbf\u4f1a\u53d1\u5e03\u4e00\u4e2a\u65b0\u7684\u6807\u51c6\u7248\u672c\u3002\u5176\u4e2d C11 \u88ab\u5e7f\u6cdb\u89c6\u4e3a\u4e00\u6b21\u91cc\u7a0b\u7891\u5f0f\u7684\u66f4\u65b0&#xff0c;\u5b83\u8ba9 C \u4ece\u4e00\u95e8\u504f\u4f20\u7edf\u7684\u7cfb\u7edf\u7ea7\u8bed\u8a00&#xff0c;\u8f6c\u53d8\u4e3a\u66f4\u73b0\u4ee3\u3001\u66f4\u5b89\u5168\u3001\u66f4\u6613\u7528\u7684\u5f00\u53d1\u8bed\u8a00\u3002\u968f\u540e C14\u3001C17 \u548c C20 \u5728 C11 \u7684\u57fa\u7840\u4e0a\u6301\u7eed\u5b8c\u5584&#xff0c;\u4e0d\u65ad\u5f15\u5165\u65b0\u7279\u6027\u3002\u672c\u6587\u5148\u7cfb\u7edf\u68b3\u7406 C11 \u7684\u6838\u5fc3\u7279\u6027&#xff0c;\u518d\u5206\u522b\u4ecb\u7ecd C14\u3001C17 \u4e0e C20 \u7684\u4e3b\u8981\u65b0\u589e\u5185\u5bb9&#xff0c;\u5e2e\u52a9\u8bfb\u8005\u5efa\u7acb\u5bf9\u73b0\u4ee3 C \u7684\u6574\u4f53\u8ba4\u77e5<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,190],"topic":[],"class_list":["post-115555","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115555.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1. \u5f15\u8a00C \u8bed\u8a00\u5728\u957f\u671f\u6f14\u8fdb\u8fc7\u7a0b\u4e2d&#xff0c;\u6bcf\u9694\u6570\u5e74\u4fbf\u4f1a\u53d1\u5e03\u4e00\u4e2a\u65b0\u7684\u6807\u51c6\u7248\u672c\u3002\u5176\u4e2d C11 \u88ab\u5e7f\u6cdb\u89c6\u4e3a\u4e00\u6b21\u91cc\u7a0b\u7891\u5f0f\u7684\u66f4\u65b0&#xff0c;\u5b83\u8ba9 C \u4ece\u4e00\u95e8\u504f\u4f20\u7edf\u7684\u7cfb\u7edf\u7ea7\u8bed\u8a00&#xff0c;\u8f6c\u53d8\u4e3a\u66f4\u73b0\u4ee3\u3001\u66f4\u5b89\u5168\u3001\u66f4\u6613\u7528\u7684\u5f00\u53d1\u8bed\u8a00\u3002\u968f\u540e C14\u3001C17 \u548c C20 \u5728 C11 \u7684\u57fa\u7840\u4e0a\u6301\u7eed\u5b8c\u5584&#xff0c;\u4e0d\u65ad\u5f15\u5165\u65b0\u7279\u6027\u3002\u672c\u6587\u5148\u7cfb\u7edf\u68b3\u7406 C11 \u7684\u6838\u5fc3\u7279\u6027&#xff0c;\u518d\u5206\u522b\u4ecb\u7ecd C14\u3001C17 \u4e0e C20 \u7684\u4e3b\u8981\u65b0\u589e\u5185\u5bb9&#xff0c;\u5e2e\u52a9\u8bfb\u8005\u5efa\u7acb\u5bf9\u73b0\u4ee3 C \u7684\u6574\u4f53\u8ba4\u77e5\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115555.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-12T07:17:16+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115555.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115555.html\",\"name\":\"C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-12T07:17:16+00:00\",\"dateModified\":\"2026-10-12T07:17:16+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115555.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115555.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115555.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115555.html","og_locale":"zh_CN","og_type":"article","og_title":"C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1. \u5f15\u8a00C \u8bed\u8a00\u5728\u957f\u671f\u6f14\u8fdb\u8fc7\u7a0b\u4e2d&#xff0c;\u6bcf\u9694\u6570\u5e74\u4fbf\u4f1a\u53d1\u5e03\u4e00\u4e2a\u65b0\u7684\u6807\u51c6\u7248\u672c\u3002\u5176\u4e2d C11 \u88ab\u5e7f\u6cdb\u89c6\u4e3a\u4e00\u6b21\u91cc\u7a0b\u7891\u5f0f\u7684\u66f4\u65b0&#xff0c;\u5b83\u8ba9 C \u4ece\u4e00\u95e8\u504f\u4f20\u7edf\u7684\u7cfb\u7edf\u7ea7\u8bed\u8a00&#xff0c;\u8f6c\u53d8\u4e3a\u66f4\u73b0\u4ee3\u3001\u66f4\u5b89\u5168\u3001\u66f4\u6613\u7528\u7684\u5f00\u53d1\u8bed\u8a00\u3002\u968f\u540e C14\u3001C17 \u548c C20 \u5728 C11 \u7684\u57fa\u7840\u4e0a\u6301\u7eed\u5b8c\u5584&#xff0c;\u4e0d\u65ad\u5f15\u5165\u65b0\u7279\u6027\u3002\u672c\u6587\u5148\u7cfb\u7edf\u68b3\u7406 C11 \u7684\u6838\u5fc3\u7279\u6027&#xff0c;\u518d\u5206\u522b\u4ecb\u7ecd C14\u3001C17 \u4e0e C20 \u7684\u4e3b\u8981\u65b0\u589e\u5185\u5bb9&#xff0c;\u5e2e\u52a9\u8bfb\u8005\u5efa\u7acb\u5bf9\u73b0\u4ee3 C \u7684\u6574\u4f53\u8ba4\u77e5","og_url":"https:\/\/www.wsisp.com\/helps\/115555.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-12T07:17:16+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115555.html","url":"https:\/\/www.wsisp.com\/helps\/115555.html","name":"C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-12T07:17:16+00:00","dateModified":"2026-10-12T07:17:16+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115555.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115555.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115555.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C++11\u6838\u5fc3\u7279\u6027\u8be6\u89e3\uff1a\u4eceC++11\u5230C++20 \u7684\u73b0\u4ee3C++\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115555"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115555\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115555"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}