{"id":101054,"date":"2026-09-06T01:57:00","date_gmt":"2026-09-05T17:57:00","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/101054.html"},"modified":"2026-09-06T01:57:00","modified_gmt":"2026-09-05T17:57:00","slug":"%e8%87%aa%e5%ae%9a%e4%b9%89%e6%97%a5%e5%bf%97%e7%bc%93%e5%86%b2%e5%8c%ba%ef%bc%88%e4%b8%8a%ef%bc%89c20","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/101054.html","title":{"rendered":"\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20"},"content":{"rendered":"<h2>\u5f15\u8a00<\/h2>\n<p>\u672c\u7bc7\u6587\u7ae0\u4f7f\u7528c&#043;&#043;20\u6807\u51c6\u5b9e\u73b0\u7684\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u65e5\u5fd7\u7f13\u51b2\u533a\u3002\u6253\u5370\u65e5\u5fd7\u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u9879\u76ee\u6765\u8bf4\u90fd\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684&#xff0c;\u5728muduo\u5e93\u91cc\u9762\u6211\u4eec\u4e5f\u7b80\u5355\u7684\u5b9e\u73b0\u4e86\u4e00\u4e2a\u65e5\u5fd7\u7684\u6253\u5370&#xff0c;\u5927\u5bb6\u5982\u679c\u6709\u5174\u8da3\u53ef\u4ee5\u770b\u4e00\u770b\u6211\u4e4b\u524d\u7684\u8fd9\u4e2a\u535a\u5ba2\u5199\u6587\u7ae0-CSDN\u521b\u4f5c\u4e2d\u5fc3\u3002\u4e0d\u8fc7\u90a3\u4e2a\u662f\u6bd4\u8f83\u7b80\u6613\u7684&#xff0c;\u800c\u672c\u7bc7\u6587\u7ae0\u7684\u4e0a\u4e0b\u7bc7\u5c06\u5b8c\u6210\u4e00\u4e2a\u590d\u6742&#xff0c;\u9ad8\u6027\u80fd\u7684\u6253\u5370\u65e5\u5fd7\u5668\u3002<\/p>\n<h2>\u65e5\u5fd7<\/h2>\n<p>\u6253\u5370\u65e5\u5fd7\u662f\u4e3a\u4e86\u53ef\u4ee5\u66f4\u5feb\u7684\u53d1\u73b0\u9519\u8bef&#xff0c;\u800c\u6211\u4eec\u7684\u9519\u8bef\u662f\u5206\u7b49\u7ea7\u7684&#xff0c;\u6709\u7684\u9519\u8bef\u65e0\u4f24\u5927\u96c5&#xff0c;\u800c\u6709\u7684\u9519\u8bef\u4e00\u65e6\u53d1\u751f\u5c31\u4f1a\u9020\u6210\u635f\u5931&#xff0c;\u6240\u4ee5\u6211\u4eec\u9700\u8981\u7ed9\u65e5\u5fd7\u5206\u51e0\u4e2a\u7ea7\u522b\u3001<\/p>\n<p>\u7136\u540e\u5bf9\u4e8e\u65e5\u5fd7\u6240\u5bf9\u5916\u63d0\u4f9b\u7684\u51fd\u6570&#xff0c;\u4e00\u5171\u5c31\u4e24\u4e2a&#xff0c;\u4e00\u4e2a\u662f\u628aLevel\u8f6c\u5316\u6210string\u7684\u7c7b\u578b&#xff0c;\u56e0\u4e3a\u6211\u4eec\u7684enum\u5e95\u5c42\u8fd8\u662fuint8\u7c7b\u578b&#xff0c;\u6211\u4eec\u4e3a\u4e86\u53ef\u4ee5\u66f4\u597d\u7684\u770b\u51fa\u5230\u5e95\u662f\u4ec0\u4e48\u7c7b\u578b\u7684\u9519\u8bef&#xff0c;\u9700\u8981\u8f6c\u5316\u6210\u5b57\u7b26\u4e32\u3002<\/p>\n<p>\u8fd8\u6709\u4e00\u4e2a\u662f\u628a\u4e00\u4e2a\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u65e5\u5fd7\u7ea7\u522b&#xff0c;\u8f6c\u6362\u6210 LogLevel::Level \u679a\u4e3e\u503c&#xff0c;\u4e00\u822c\u7684\u7528\u6cd5\u5982\u4e0b&#xff1a;<\/p>\n<p>auto level &#061; LogLevel::FromString(&#034;debug&#034;);<br \/>\nclass PANS_API LogLevel final<br \/>\n{<br \/>\npublic:<br \/>\n    enum class Level : std::uint8_t<br \/>\n    {<br \/>\n        LOG_DEBUG, \/\/ \u8c03\u8bd5\u7ec6\u8282<br \/>\n        LOG_INFO,  \/\/ \u8bb0\u5f55\u6b63\u5e38\u8fd0\u884c\u7684\u4fe1\u606f<br \/>\n        LOG_WARN,  \/\/ \u53ef\u80fd\u5b58\u5728\u7684\u95ee\u9898<br \/>\n        LOG_ERROR, \/\/ \u64cd\u4f5c\u5931\u8d25&#xff0c;\u9700\u8981\u68c0\u67e5<br \/>\n        LOG_FATAL, \/\/ \u7a0b\u5e8f\u5982\u679c\u7ee7\u7eed\u8fd0\u884c\u4f1a\u9020\u6210\u635f\u5931<br \/>\n        LOG_OFF,   \/\/ \u5173\u95ed\u65e5\u5fd7<br \/>\n    };<\/p>\n<p>    [[nodiscard]] static std::string_view ToString(Level level) noexcept;<br \/>\n    [[nodiscard]] static LogLevel::Level FromString(std::string_view value) noexcept;<br \/>\n}; <\/p>\n<p>\u6211\u4eec\u8fd9\u91cc\u7528\u5b8f\u6765\u7b80\u5316\u4ee3\u7801\u7684\u4e66\u5199&#xff0c;\u5e76\u4e14\u56e0\u4e3a\u8fd9\u4e2a\u5b8f\u662f\u5b9a\u4e49\u5728\u51fd\u6570\u7684\u5185\u90e8&#xff0c;\u6240\u4ee5\u5f53\u6211\u4eec\u7528\u5b8c\u8fd9\u4e2a\u5b8f\u4e4b\u540e&#xff0c;\u6211\u4eec\u9700\u8981\u53ca\u65f6\u7684\u91ca\u653e\u6389\u3002FromString\u8fd9\u4e2a\u51fd\u6570\u7684\u601d\u8def\u5c31\u662f\u521b\u5efa\u4e00\u4e2a\u6570\u7ec4\u6765\u5b58\u50a8\u5927\u5199\u7684value&#xff0c;\u7136\u540e\u8fd4\u56de\u8fd9\u4e2a&#xff0c;\u6240\u4ee5\u4e3b\u8981\u7684\u4f5c\u7528\u5c31\u662f\u8f6c\u5316\u4e3a\u5927\u5199&#xff0c;\u56e0\u4e3a\u5916\u90e8\u53ef\u80fd\u4f1a\u4f20\u9012\u5c0f\u5199\u7684&#xff0c;\u7c7b\u4f3c\u4e8edebug\u4e4b\u7c7b\u7684\u3002<\/p>\n<p>std::string_view LogLevel::ToString(Level level) noexcept<br \/>\n{<br \/>\n    switch (level)<br \/>\n    {<br \/>\n#define XX(name) case Level::LOG_##name : return #name;<br \/>\n        XX(DEBUG)<br \/>\n        XX(INFO)<br \/>\n        XX(WARN)<br \/>\n        XX(ERROR)<br \/>\n        XX(FATAL)<br \/>\n        XX(OFF)<br \/>\n    }<br \/>\n#undef XX<br \/>\n    return &#034;UNKNOWN&#034;;<br \/>\n}<\/p>\n<p>\/\/ \u628a\u4e00\u4e2a\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u65e5\u5fd7\u7ea7\u522b&#xff0c;\u8f6c\u6362\u6210 LogLevel::Level \u679a\u4e3e\u503c<br \/>\nLogLevel::Level LogLevel::FromString(std::string_view value) noexcept<br \/>\n{<br \/>\n    std::array&lt;char, 6&gt; normalized{};<br \/>\n    std::transform(value.begin(), value.end(), normalized.begin(), [](unsigned char character){<br \/>\n        return static_cast&lt;char&gt;(std::toupper(character));<br \/>\n    });<br \/>\n    const std::string_view upper_value(normalized.data(), value.size());<br \/>\n#define XX(name) if(upper_value &#061;&#061; #name) return Level::LOG_##name;<br \/>\n    XX(DEBUG)<br \/>\n    XX(INFO)<br \/>\n    XX(WARN)<br \/>\n    XX(FATAL)<br \/>\n    XX(OFF)<br \/>\n    XX(ERROR)<br \/>\n#undef XX<br \/>\n    return Level::LOG_OFF;<br \/>\n} <\/p>\n<h2>\u7f13\u51b2\u533a<\/h2>\n<p>\u63a5\u4e0b\u6765\u5c31\u662f\u6bd4\u8f83\u5173\u952e\u7684\u7f13\u51b2\u533a&#xff0c;\u5176\u5b9e\u5927\u90e8\u5206\u7684\u9879\u76ee\u91cc\u9762\u6253\u5370\u7684\u65e5\u5fd7\u90fd\u662f\u5728\u5806\u4e0a\u6253\u5370\u7684&#xff0c;\u5806\u4e0a\u5199\u5b8c\u5373\u91ca\u653e&#xff0c;\u91cc\u9762\u6bd4\u8f83\u5178\u578b\u7684\u5c31\u662fsylar\u7684\u670d\u52a1\u5668\u67b6\u6784&#xff0c;\u5c31\u662f\u7528std::stringstream&#xff0c;\u8fd9\u4e2a\u7684\u4f18\u70b9\u5c31\u662f\u6bd4\u8f83\u7684\u7b80\u5355\u5bb9\u6613\u5b9e\u73b0\u3002\u4f46\u662f\u7f3a\u70b9\u4e5f\u6bd4\u8f83\u660e\u663e&#xff0c;\u6211\u4eec\u62ff\u5230\u6570\u636e\u7684\u65f6\u5019\u9700\u8981\u7528std::string\u6765\u63a5\u53d7&#xff0c;\u591a\u4e86\u4e00\u6b21\u62f7\u8d1d&#xff0c;\u800c\u81ea\u5b9a\u4e49\u7684\u7f13\u51b2\u533a\u6211\u4eec\u53ef\u4ee5\u5f00\u7a97\u53e3&#xff0c;\u7528string_view\u6765\u76f4\u63a5\u62ff\u6570\u636e\u3002<\/p>\n<p>\u56e0\u4e3a\u4e00\u822c\u7684\u65e5\u5fd7\u90fd\u662f\u5c11\u4e8e200\u5b57\u7684&#xff0c;\u6808\u7684\u7a7a\u95f4\u5b8c\u5168\u8db3\u591f&#xff0c;\u4f46\u662f\u4e5f\u4e0d\u6392\u9664\u4e00\u4e9b\u6bd4\u8f83\u957f\u7684\u65e5\u5fd7\u4fe1\u606f&#xff0c;\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u5c31\u9700\u8981\u628a\u65e5\u5fd7\u7684\u5185\u5bb9\u653e\u5728\u5806\u4e0a&#xff0c;\u65b9\u4fbf\u6269\u5bb9\u5904\u7406\u3002\u6240\u4ee5\u6211\u4eec\u7684\u76ee\u7684\u5c31\u662f\u5982\u679c\u65e5\u5fd7\u4fe1\u606f\u6bd4\u8f83\u5c11\u5c31\u5728\u6808\u4e0a&#xff0c;\u65e5\u5fd7\u6bd4\u8f83\u957f\u5c31\u5728\u5806\u4e0a\u3002\u90a3\u4e48\u6211\u4eec\u5f88\u5bb9\u6613\u60f3\u5230\u7684\u67b6\u6784\u5c31\u662farray\u548cvector<\/p>\n<p>\u8fd9\u91cc\u89e3\u91ca\u4e00\u4e0b&#xff0c;\u6211\u4eec\u5728\u7f13\u51b2\u533a\u5bf9\u8c61\u91cc\u9762\u7684\u6210\u5458array\u548c\u6210\u5458\u4e00\u8d77\u88ab\u653e\u5728\u4e86\u6808\u4e0a&#xff0c;\u968f\u7740\u7f13\u51b2\u533a\u4e00\u8d77\u88ab\u9500\u6bc1&#xff0c;\u800cvector\u7684\u4e00\u4e9b\u5c5e\u6027&#xff0c;\u6bd4\u5982size&#xff0c;type\u653e\u5728\u4e86\u6808\u4e0a&#xff0c;\u5176\u6570\u636e\u662f\u653e\u5728\u4e86\u5806\u4e0a&#xff0c;\u65b9\u4fbf\u6269\u5bb9\u3002<\/p>\n<p>\u6211\u4eec\u8fd9\u91cc\u8fd8\u662f\u7528\u7684\u7c7b\u6a21\u677f&#xff0c;\u56e0\u4e3a\u6211\u4eec\u7684\u5185\u8054\u7f13\u51b2\u533a\u7684\u5927\u5c0f\u8fd8\u662f\u4e0d\u786e\u5b9a\u7684&#xff0c;\u5176\u4e2d\u5bf9\u5916\u63d0\u4f9b\u7684API\u4e3b\u8981\u5c31\u662fappend&#xff0c;\u5176\u4e2d\u7684\u903b\u8f91\u662f\u5982\u679c\u5806\u4e0a\u6ca1\u6709\u5185\u5bb9\u5e76\u4e14\u8981\u5199\u7684\u5185\u5bb9\u6ca1\u6709\u8d85\u8fc7\u9650\u5236&#xff0c;\u90a3\u4e48\u5c31\u5199\u5165inline<\/p>\n<p>\u5982\u679c\u8d85\u51fa\u4e86&#xff0c;\u5e76\u4e14overflow\u662f\u7a7a\u7684&#xff0c;\u90a3\u4e48\u6211\u4eec\u5148\u628a\u4e4b\u524d\u5728inline\u7684\u6570\u636e\u901a\u8fc7insert\u62f7\u8d1d\u5230overflow\u91cc\u9762&#xff0c;\u518d\u628a\u5f53\u524d\u7684\u6570\u636einsert\u5230end&#xff08;&#xff09;\u540e\u9762\u3002<\/p>\n<p>\u8fd9\u91cc\u8981\u8bf4\u660e\u4e00\u4e0b\u5b50std::string_view&#xff0c;\u8fd9\u4e2a\u6027\u80fd\u5f88\u9ad8&#xff0c;\u56e0\u4e3a\u5176\u4e0d\u9700\u8981\u62f7\u8d1d\u5230string&#xff0c;\u91cc\u9762\u7ba1\u7406\u4e86\u4e00\u4e2a\u6307\u9488ptr\u548cstring\u7684\u5927\u5c0fsize&#xff0c;\u6240\u4ee5\u6211\u4eec<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49\u4e00\u4e2a\u65e5\u5fd7\u7f13\u51b2\u533a&#xff0c;\u9488\u5bf9\u9ad8\u9891&#xff0c;\u5c0f\u6570\u636e\u91cf\u7684\u65e5\u5fd7\u573a\u666f&#xff0c;\u5728\u6808\u4e0a\u5206\u914d\u65e5\u5fd7\u7f13\u51b2\u533a&#xff0c;\u4e0e\u8d85\u957f\u65e5\u5fd7&#xff0c;\u518d\u5728\u5806\u4e0a\u5206\u914d\u5185\u5b58<br \/>\ntemplate &lt;std::size_t INLINE_CAPACITY&gt;<br \/>\nclass InlineBuffer<br \/>\n{<br \/>\npublic:<br \/>\n    void append(const char* data, std::size_t size)<br \/>\n    {<br \/>\n        if (size &#061;&#061; 0)<br \/>\n        {<br \/>\n            return;<br \/>\n        }<br \/>\n        if (overflow_.empty() &amp;&amp; size &#043; size_ &lt;&#061; INLINE_CAPACITY)<br \/>\n        {<br \/>\n            std::memcpy(inline_.data() &#043; size_, data, size);<br \/>\n            size_ &#043;&#061; size;<br \/>\n            return;<br \/>\n        }<\/p>\n<p>        if (overflow_.empty())<br \/>\n        {<br \/>\n            const std::size_t required_capacity &#061; size_ &#043; size;<br \/>\n            overflow_.reserve(std::max(required_capacity, 2 * INLINE_CAPACITY));<br \/>\n            overflow_.insert(overflow_.end(), inline_.data(), inline_.data() &#043; size_);<br \/>\n        }<br \/>\n        overflow_.insert(overflow_.end(), data, data &#043; size);<br \/>\n        size_ &#043;&#061; size;<br \/>\n    }<\/p>\n<p>    void append(std::string_view value)<br \/>\n    {<br \/>\n        append(value.data(), value.size());<br \/>\n    }<\/p>\n<p>    void append(char value)<br \/>\n    {<br \/>\n        append(&amp;value, 1);<br \/>\n    }<\/p>\n<p>    [[nodiscard]] const char* data() const noexcept<br \/>\n    {<br \/>\n        return overflow_.empty() ? inline_.data() : overflow_.data();<br \/>\n    }<\/p>\n<p>    [[nodiscard]] std::size_t size() const noexcept<br \/>\n    {<br \/>\n        return size_;<br \/>\n    }<\/p>\n<p>    [[nodiscard]] std::string_view view() const noexcept<br \/>\n    {<br \/>\n        return {data(), size()};<br \/>\n    }<\/p>\n<p>private:<br \/>\n    std::array&lt;char, INLINE_CAPACITY&gt; inline_{};<br \/>\n    std::vector&lt;char&gt; overflow_;<br \/>\n    std::size_t size_;<br \/>\n}; <\/p>\n<p>\u4e3a\u4e86\u7ee7\u7eed\u53ef\u4ee5\u4f7f\u7528\u6d41\u5f0f\u8f93\u5165\u7684\u63a5\u53e3&#xff0c;\u6211\u4eec\u91cd\u65b0\u5b9e\u73b0\u4e86\u4e00\u4e2astreambuf&#xff0c;\u7136\u540e\u91cd\u5199\u5bf9\u5e94\u7684\u63a5\u53e3\u3002<\/p>\n<p>\u8fd9\u4e2a\u662f\u6211\u4eec\u7684\u76ee\u6807&#xff0c;\u4f46\u662f\u4e0e\u7cfb\u7edf\u63d0\u4f9bput_area\u4e0d\u540c\u7684\u662f&#xff0c;\u6211\u4eec\u6709\u81ea\u5df1\u7684\u7f13\u51b2\u533a\u4e86&#xff0c;\u7cfb\u7edf\u7684put_area\u4f1a\u7ef4\u62a4\u4e24\u4e2a\u6307\u9488pptr\u548cepptr&#xff0c;\u800c\u6211\u4eec\u56e0\u4e3a\u6ca1\u6709\u63d0\u4f9b\u8fd9\u4e2aput_area\u6240\u4ee5\u4e0d\u4f1a\u8fdb\u5165if&#xff08;&#xff09;\u91cc\u9762&#xff0c;\u800c\u662f\u76f4\u63a5return&#xff0c;\u6267\u884coverflow\u51fd\u6570&#xff08;\u6211\u4eec\u9700\u8981\u91cd\u5199&#xff09;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"291\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260905175659-6a9c57eb87b2b.png\" width=\"713\" \/><\/p>\n<p>std::ostream \u8d1f\u8d23\u683c\u5f0f\u5316\u8f93\u51fa&#xff0c;std::streambuf \u8d1f\u8d23\u628a\u6570\u636e\u4ea4\u7ed9\u5b9e\u9645\u7684\u5b58\u50a8\u5bf9\u8c61\u3002<\/p>\n<p>streambuf \u9ed8\u8ba4\u6ca1\u6709\u81ea\u5df1\u7684\u8f93\u51fa\u7f13\u51b2\u533a&#xff0c;pbase\/pptr\/epptr \u90fd\u4e3a\u7a7a&#xff1b;<\/p>\n<p>\u5982\u679c\u901a\u8fc7 setp() \u8bbe\u7f6e\u7f13\u51b2\u533a&#xff0c;sputc() \u4f1a\u5148\u5224\u65ad pptr() &lt; epptr()&#xff0c; \u6709\u7a7a\u95f4\u5c31\u76f4\u63a5\u5199\u5165&#xff0c;\u6ca1\u6709\u7a7a\u95f4\u624d\u8c03\u7528 overflow()\u3002<\/p>\n<p>\u591a\u4e2a\u5b57\u7b26\u901a\u8fc7 sputn() \u8fdb\u5165\u865a\u51fd\u6570 xsputn()\u3002 \u672c\u7c7b\u6ca1\u6709\u8c03\u7528 setp()&#xff0c;\u56e0\u6b64\u4e0d\u4f7f\u7528 streambuf \u81ea\u5df1\u7684\u7f13\u51b2\u533a&#xff1a;<\/p>\n<p>\u5355\u5b57\u7b26 -&gt; sputc() -&gt; \u65e0\u53ef\u7528\u7a7a\u95f4 -&gt; overflow() -&gt; InlineBuffer<\/p>\n<p>\u591a\u5b57\u7b26 -&gt; sputn() -&gt; xsputn() -&gt; InlineBuffer<\/p>\n<p>\u6240\u4ee5 SmallStreamBuffer \u7684\u4f5c\u7528\u5c31\u662f&#xff1a; \u628a std::ostream \u7684\u8f93\u51fa\u63a5\u53e3\u76f4\u63a5\u8f6c\u63a5\u5230\u81ea\u5df1\u7684 InlineBuffer\u3002<\/p>\n<p>\/\/ \u7ee7\u627fstd::streambuf\u662f\u4e3a\u4e86\u80fd\u591f\u80fd\u591f\u7ee7\u7eed\u4f7f\u7528\u6d41\u5f0f\u8f93\u5165\u63a5\u53e3&#xff0c;\u517c\u5bb9ostream\u751f\u6001<br \/>\ntemplate &lt;std::size_t INLINE_CAPACITY&gt;<br \/>\nclass SmallStreamBuffer : public std::streambuf<br \/>\n{<br \/>\npublic:<br \/>\n    explicit SmallStreamBuffer(InlineBuffer&lt;INLINE_CAPACITY&gt;&amp; buffer) noexcept<br \/>\n        : buffer_(buffer)<br \/>\n    {}<\/p>\n<p>protected:<br \/>\n    std::streamsize xsputn(const char* data, std::streamsize size) override<br \/>\n    {<br \/>\n        if (size &lt;&#061; 0)<br \/>\n        {<br \/>\n            return 0;<br \/>\n        }<\/p>\n<p>        buffer_.append(data, static_cast&lt;std::size_t&gt;(size));<br \/>\n        return size;<br \/>\n    }<\/p>\n<p>    int_type overflow(int_type character) override<br \/>\n    {<br \/>\n        \/\/ overflow&#xff0c;\u9664\u4e86\u53ef\u4ee5\u63a5\u53d7\u4e00\u822c\u5b57\u7b26&#xff0c;\u8fd8\u53ef\u80fd\u4f1a\u63a5\u6536\u6d41\u7ec8\u6b62\u7b26EOF<br \/>\n        \/\/ \u5982\u679c\u6211\u4eec\u9047\u5230\u4e86EOF, \u628a\u5b83\u8f6c\u6210\u975eEOF\u503c\u5411\u4e0a\u62a5\u544a\u5199\u5165\u6210\u529f&#xff0c;\u5b9e\u9645\u4e0a\u4e0d\u5411Buffer\u91cc\u5199\u5165\u4efb\u4f55\u503c\u3002<br \/>\n        if (traits_type::eq_int_type(character, traits_type::eof()))<br \/>\n        {<br \/>\n            return traits_type::not_eof(character);<br \/>\n        }<br \/>\n        buffer_.append(traits_type::to_char_type(character));<br \/>\n        return character;<br \/>\n    }<\/p>\n<p>private:<br \/>\n    InlineBuffer&lt;INLINE_CAPACITY&gt;&amp; buffer_;<br \/>\n}; <\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u672c\u7bc7\u6587\u7ae0\u5230\u8fd9\u91cc\u5c31\u7ed3\u675f\u4e86&#xff01;&#xff01;&#xff01;&#xff01;\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5927\u5bb6\u7406\u89e3~~~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00<br \/>\n\u672c\u7bc7\u6587\u7ae0\u4f7f\u7528c20\u6807\u51c6\u5b9e\u73b0\u7684\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u65e5\u5fd7\u7f13\u51b2\u533a\u3002\u6253\u5370\u65e5\u5fd7\u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u9879\u76ee\u6765\u8bf4\u90fd\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684&#xff0c;\u5728muduo\u5e93\u91cc\u9762\u6211\u4eec\u4e5f\u7b80\u5355\u7684\u5b9e\u73b0\u4e86\u4e00\u4e2a\u65e5\u5fd7\u7684\u6253\u5370&#xff0c;\u5927\u5bb6\u5982\u679c\u6709\u5174\u8da3\u53ef\u4ee5\u770b\u4e00\u770b\u6211\u4e4b\u524d\u7684\u8fd9\u4e2a\u535a\u5ba2\u5199\u6587\u7ae0-CSDN\u521b\u4f5c\u4e2d\u5fc3\u3002\u4e0d\u8fc7\u90a3\u4e2a\u662f\u6bd4\u8f83\u7b80\u6613\u7684&#xff0c;\u800c\u672c\u7bc7\u6587\u7ae0\u7684\u4e0a\u4e0b\u7bc7\u5c06\u5b8c\u6210\u4e00\u4e2a\u590d\u6742&#xff0c;\u9ad8\u6027\u80fd\u7684\u6253\u5370\u65e5\u5fd7\u5668\u3002<br \/>\n\u65e5\u5fd7<br \/>\n\u6253\u5370\u65e5\u5fd7\u662f\u4e3a\u4e86\u53ef\u4ee5\u66f4\u5feb\u7684\u53d1\u73b0\u9519\u8bef&#xff0c;\u800c\u6211\u4eec\u7684\u9519\u8bef\u662f\u5206\u7b49\u7ea7\u7684&#xff0c;\u6709\u7684\u9519\u8bef\u65e0\u4f24\u5927\u96c5&amp;#xff0c<\/p>\n","protected":false},"author":2,"featured_media":101053,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,58,43,396],"topic":[],"class_list":["post-101054","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-linux","tag-43","tag-396"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20 - \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\/101054.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5f15\u8a00 \u672c\u7bc7\u6587\u7ae0\u4f7f\u7528c20\u6807\u51c6\u5b9e\u73b0\u7684\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u65e5\u5fd7\u7f13\u51b2\u533a\u3002\u6253\u5370\u65e5\u5fd7\u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u9879\u76ee\u6765\u8bf4\u90fd\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684&#xff0c;\u5728muduo\u5e93\u91cc\u9762\u6211\u4eec\u4e5f\u7b80\u5355\u7684\u5b9e\u73b0\u4e86\u4e00\u4e2a\u65e5\u5fd7\u7684\u6253\u5370&#xff0c;\u5927\u5bb6\u5982\u679c\u6709\u5174\u8da3\u53ef\u4ee5\u770b\u4e00\u770b\u6211\u4e4b\u524d\u7684\u8fd9\u4e2a\u535a\u5ba2\u5199\u6587\u7ae0-CSDN\u521b\u4f5c\u4e2d\u5fc3\u3002\u4e0d\u8fc7\u90a3\u4e2a\u662f\u6bd4\u8f83\u7b80\u6613\u7684&#xff0c;\u800c\u672c\u7bc7\u6587\u7ae0\u7684\u4e0a\u4e0b\u7bc7\u5c06\u5b8c\u6210\u4e00\u4e2a\u590d\u6742&#xff0c;\u9ad8\u6027\u80fd\u7684\u6253\u5370\u65e5\u5fd7\u5668\u3002 \u65e5\u5fd7 \u6253\u5370\u65e5\u5fd7\u662f\u4e3a\u4e86\u53ef\u4ee5\u66f4\u5feb\u7684\u53d1\u73b0\u9519\u8bef&#xff0c;\u800c\u6211\u4eec\u7684\u9519\u8bef\u662f\u5206\u7b49\u7ea7\u7684&#xff0c;\u6709\u7684\u9519\u8bef\u65e0\u4f24\u5927\u96c5&amp;#xff0c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/101054.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-05T17:57:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260905175659-6a9c57eb87b2b.png\" \/>\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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/101054.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/101054.html\",\"name\":\"\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-05T17:57:00+00:00\",\"dateModified\":\"2026-09-05T17:57:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/101054.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/101054.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/101054.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20\"}]},{\"@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":"\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20 - \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\/101054.html","og_locale":"zh_CN","og_type":"article","og_title":"\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5f15\u8a00 \u672c\u7bc7\u6587\u7ae0\u4f7f\u7528c20\u6807\u51c6\u5b9e\u73b0\u7684\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u65e5\u5fd7\u7f13\u51b2\u533a\u3002\u6253\u5370\u65e5\u5fd7\u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u9879\u76ee\u6765\u8bf4\u90fd\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684&#xff0c;\u5728muduo\u5e93\u91cc\u9762\u6211\u4eec\u4e5f\u7b80\u5355\u7684\u5b9e\u73b0\u4e86\u4e00\u4e2a\u65e5\u5fd7\u7684\u6253\u5370&#xff0c;\u5927\u5bb6\u5982\u679c\u6709\u5174\u8da3\u53ef\u4ee5\u770b\u4e00\u770b\u6211\u4e4b\u524d\u7684\u8fd9\u4e2a\u535a\u5ba2\u5199\u6587\u7ae0-CSDN\u521b\u4f5c\u4e2d\u5fc3\u3002\u4e0d\u8fc7\u90a3\u4e2a\u662f\u6bd4\u8f83\u7b80\u6613\u7684&#xff0c;\u800c\u672c\u7bc7\u6587\u7ae0\u7684\u4e0a\u4e0b\u7bc7\u5c06\u5b8c\u6210\u4e00\u4e2a\u590d\u6742&#xff0c;\u9ad8\u6027\u80fd\u7684\u6253\u5370\u65e5\u5fd7\u5668\u3002 \u65e5\u5fd7 \u6253\u5370\u65e5\u5fd7\u662f\u4e3a\u4e86\u53ef\u4ee5\u66f4\u5feb\u7684\u53d1\u73b0\u9519\u8bef&#xff0c;\u800c\u6211\u4eec\u7684\u9519\u8bef\u662f\u5206\u7b49\u7ea7\u7684&#xff0c;\u6709\u7684\u9519\u8bef\u65e0\u4f24\u5927\u96c5&amp;#xff0c","og_url":"https:\/\/www.wsisp.com\/helps\/101054.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-05T17:57:00+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260905175659-6a9c57eb87b2b.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/101054.html","url":"https:\/\/www.wsisp.com\/helps\/101054.html","name":"\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-05T17:57:00+00:00","dateModified":"2026-09-05T17:57:00+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/101054.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/101054.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/101054.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u81ea\u5b9a\u4e49\u65e5\u5fd7\u7f13\u51b2\u533a\uff08\u4e0a\uff09c++20"}]},{"@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\/101054","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=101054"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/101054\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/101053"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=101054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=101054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=101054"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=101054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}