{"id":61170,"date":"2026-01-17T07:17:35","date_gmt":"2026-01-16T23:17:35","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/61170.html"},"modified":"2026-01-17T07:17:35","modified_gmt":"2026-01-16T23:17:35","slug":"c%e8%b5%84%e6%ba%90%e7%ae%a1%e7%90%86%ef%bc%9araii%e4%b8%8e%e6%99%ba%e8%83%bd%e6%8c%87%e9%92%88%e7%bb%88%e6%9e%81%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/61170.html","title":{"rendered":"C++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\u6307\u5357"},"content":{"rendered":"<p>\u597d\u7684&#xff0c;\u8fd9\u662f\u4e00\u4efd\u5173\u4e8eC&#043;&#043;\u8d44\u6e90\u7ba1\u7406\u6838\u5fc3\u5b9e\u8df5\u2014\u2014RAII\u548c\u667a\u80fd\u6307\u9488\u7684\u6307\u5357&#xff0c;\u7279\u522b\u805a\u7126\u4e8e\u73b0\u4ee3C&#043;&#043;&#xff08;C&#043;&#043;11\u53ca\u4e4b\u540e&#xff09;\u7684\u6700\u4f73\u5b9e\u8df5\u548cC&#043;&#043; Core Guidelines\u7684\u5efa\u8bae\u3002<\/p>\n<h2>C&#043;&#043;\u8d44\u6e90\u7ba1\u7406\u7ec8\u6781\u6307\u5357&#xff1a;RAII\u4e0e\u667a\u80fd\u6307\u9488\u6700\u4f73\u5b9e\u8df5<\/h2>\n<p>\u5728C&#043;&#043;\u4e2d&#xff0c;\u624b\u52a8\u7ba1\u7406\u8d44\u6e90&#xff08;\u5982\u52a8\u6001\u5185\u5b58\u3001\u6587\u4ef6\u53e5\u67c4\u3001\u7f51\u7edc\u8fde\u63a5\u3001\u9501\u7b49&#xff09;\u662f\u590d\u6742\u4e14\u6613\u9519\u7684\u6765\u6e90\u3002\u8d44\u6e90\u6cc4\u6f0f&#xff08;\u5fd8\u8bb0\u91ca\u653e&#xff09;\u548c\u65e0\u6548\u8bbf\u95ee&#xff08;\u91ca\u653e\u540e\u4f7f\u7528&#xff09;\u662f\u5e38\u89c1\u7684\u4e25\u91cd\u9519\u8bef\u3002\u73b0\u4ee3C&#043;&#043;\u7684\u6838\u5fc3\u601d\u60f3\u662f\u5229\u7528\u8bed\u8a00\u7279\u6027\u81ea\u52a8\u7ba1\u7406\u8d44\u6e90\u751f\u547d\u5468\u671f&#xff0c;\u4ece\u800c\u6d88\u9664\u8fd9\u7c7b\u9519\u8bef\u3002RAII&#xff08;Resource Acquisition Is Initialization&#xff09;\u548c\u667a\u80fd\u6307\u9488\u662f\u5b9e\u73b0\u8fd9\u4e00\u76ee\u6807\u7684\u4e24\u5927\u652f\u67f1\u3002<\/p>\n<h3>1. RAII&#xff1a;\u8d44\u6e90\u7ba1\u7406\u7684\u57fa\u77f3<\/h3>\n<h4>\u6838\u5fc3\u601d\u60f3<\/h4>\n<ul>\n<li>\u8d44\u6e90\u83b7\u53d6\u5373\u521d\u59cb\u5316&#xff1a;\u8d44\u6e90\u7684\u83b7\u53d6&#xff08;\u5206\u914d\u3001\u6253\u5f00\u3001\u9501\u5b9a\u7b49&#xff09;\u5e94\u5728\u5bf9\u8c61\u6784\u9020\u65f6\u5b8c\u6210\u3002<\/li>\n<li>\u8d44\u6e90\u91ca\u653e\u5373\u6790\u6784&#xff1a;\u8d44\u6e90\u7684\u91ca\u653e&#xff08;\u5220\u9664\u3001\u5173\u95ed\u3001\u89e3\u9501\u7b49&#xff09;\u5e94\u5728\u5bf9\u8c61\u6790\u6784\u65f6\u5b8c\u6210\u3002<\/li>\n<\/ul>\n<h4>\u5de5\u4f5c\u539f\u7406<\/h4>\n<li>\u5c01\u88c5\u8d44\u6e90&#xff1a;\u521b\u5efa\u4e00\u4e2a\u7c7b&#xff0c;\u5c06\u9700\u8981\u7ba1\u7406\u7684\u8d44\u6e90\u4f5c\u4e3a\u5176\u6210\u5458\u53d8\u91cf\u3002<\/li>\n<li>\u5728\u6784\u9020\u51fd\u6570\u4e2d\u83b7\u53d6\u8d44\u6e90&#xff1a;\u5f53\u521b\u5efa\u8be5\u7c7b\u7684\u5bf9\u8c61\u65f6&#xff0c;\u6784\u9020\u51fd\u6570\u8d1f\u8d23\u5206\u914d\u5185\u5b58\u3001\u6253\u5f00\u6587\u4ef6\u3001\u83b7\u53d6\u9501\u7b49\u3002<\/li>\n<li>\u5728\u6790\u6784\u51fd\u6570\u4e2d\u91ca\u653e\u8d44\u6e90&#xff1a;\u5f53\u5bf9\u8c61\u79bb\u5f00\u5176\u4f5c\u7528\u57df&#xff08;\u4f8b\u5982&#xff0c;\u51fd\u6570\u7ed3\u675f\u3001\u5757\u7ed3\u675f\u3001delete\u88ab\u8c03\u7528&#xff09;\u65f6&#xff0c;\u6790\u6784\u51fd\u6570\u4f1a\u81ea\u52a8\u88ab\u8c03\u7528&#xff0c;\u8d1f\u8d23\u91ca\u653e\u5176\u6301\u6709\u7684\u8d44\u6e90&#xff08;\u91ca\u653e\u5185\u5b58\u3001\u5173\u95ed\u6587\u4ef6\u3001\u91ca\u653e\u9501\u7b49&#xff09;\u3002<\/li>\n<h4>\u4f18\u52bf<\/h4>\n<ul>\n<li>\u81ea\u52a8\u7ba1\u7406&#xff1a;\u8d44\u6e90\u751f\u547d\u5468\u671f\u4e0e\u5bf9\u8c61\u751f\u547d\u5468\u671f\u7ed1\u5b9a\u3002\u5bf9\u8c61\u9500\u6bc1\u65f6\u8d44\u6e90\u5fc5\u7136\u88ab\u91ca\u653e&#xff0c;\u65e0\u9700\u624b\u52a8\u8c03\u7528delete\u6216close\u3002<\/li>\n<li>\u5f02\u5e38\u5b89\u5168&#xff1a;\u5373\u4f7f\u4ee3\u7801\u4e2d\u629b\u51fa\u5f02\u5e38&#xff0c;\u6808\u5c55\u5f00\u8fc7\u7a0b\u4e5f\u4f1a\u8c03\u7528\u6790\u6784\u51fd\u6570&#xff0c;\u786e\u4fdd\u8d44\u6e90\u88ab\u91ca\u653e\u3002<\/li>\n<li>\u4ee3\u7801\u7b80\u6d01&#xff1a;\u51cf\u5c11\u4e86\u663e\u5f0f\u7684\u8d44\u6e90\u91ca\u653e\u4ee3\u7801\u3002<\/li>\n<li>\u907f\u514d\u6cc4\u6f0f&#xff1a;\u6d88\u9664\u4e86\u56e0\u5fd8\u8bb0\u91ca\u653e\u8d44\u6e90\u800c\u5bfc\u81f4\u7684\u5185\u5b58\u6cc4\u6f0f\u7b49\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h4>\u793a\u4f8b&#xff1a;\u7ba1\u7406\u6587\u4ef6\u53e5\u67c4<\/h4>\n<p>class FileHandle {<br \/>\npublic:<br \/>\n    explicit FileHandle(const std::string&amp; filename, const char* mode)<br \/>\n        : handle_(std::fopen(filename.c_str(), mode)) {<br \/>\n        if (!handle_) {<br \/>\n            throw std::runtime_error(&#034;Failed to open file&#034;);<br \/>\n        }<br \/>\n    }<br \/>\n    ~FileHandle() {<br \/>\n        if (handle_) {<br \/>\n            std::fclose(handle_);<br \/>\n        }<br \/>\n    }<br \/>\n    \/\/ \u7981\u7528\u62f7\u8d1d&#xff08;\u89c1\u540e\u9762\u667a\u80fd\u6307\u9488\u90e8\u5206&#xff09;<br \/>\n    FileHandle(const FileHandle&amp;) &#061; delete;<br \/>\n    FileHandle&amp; operator&#061;(const FileHandle&amp;) &#061; delete;<br \/>\n    \/\/ \u53ef\u80fd\u9700\u8981\u79fb\u52a8\u8bed\u4e49&#xff08;\u89c1\u540e\u9762\u667a\u80fd\u6307\u9488\u90e8\u5206&#xff09;<br \/>\n    FileHandle(FileHandle&amp;&amp; other) noexcept : handle_(other.handle_) {<br \/>\n        other.handle_ &#061; nullptr;<br \/>\n    }<br \/>\n    FileHandle&amp; operator&#061;(FileHandle&amp;&amp; other) noexcept {<br \/>\n        if (this !&#061; &amp;other) {<br \/>\n            if (handle_) std::fclose(handle_);<br \/>\n            handle_ &#061; other.handle_;<br \/>\n            other.handle_ &#061; nullptr;<br \/>\n        }<br \/>\n        return *this;<br \/>\n    }<br \/>\n    \/\/ \u63d0\u4f9b\u8bbf\u95ee\u539f\u59cb\u8d44\u6e90\u7684\u63a5\u53e3&#xff08;\u8c28\u614e\u4f7f\u7528&#xff09;<br \/>\n    FILE* get() const { return handle_; }<br \/>\nprivate:<br \/>\n    FILE* handle_ &#061; nullptr;<br \/>\n};<\/p>\n<p>void useFile() {<br \/>\n    FileHandle f(&#034;data.txt&#034;, &#034;r&#034;); \/\/ \u6784\u9020\u51fd\u6570\u6253\u5f00\u6587\u4ef6<br \/>\n    \/\/ \u4f7f\u7528 f.get() \u8fdb\u884c\u6587\u4ef6\u64cd\u4f5c&#8230;<br \/>\n    \/\/ \u51fd\u6570\u7ed3\u675f\u65f6&#xff0c;f\u7684\u6790\u6784\u51fd\u6570\u81ea\u52a8\u5173\u95ed\u6587\u4ef6&#xff0c;\u5373\u4f7f\u4e2d\u9014\u629b\u51fa\u5f02\u5e38\u3002<br \/>\n}<\/p>\n<h4>C&#043;&#043; Core Guidelines \u76f8\u5173\u5efa\u8bae<\/h4>\n<ul>\n<li>R.1: \u901a\u8fc7\u8d44\u6e90\u53e5\u67c4\u548cRAII\u81ea\u52a8\u7ba1\u7406\u8d44\u6e90\u3002 (\u4f18\u5148\u4f7f\u7528\u8d44\u6e90\u7ba1\u7406\u5bf9\u8c61)<\/li>\n<li>C.33: \u5982\u679c\u7c7b\u62e5\u6709\u8d44\u6e90&#xff0c;\u5b83\u9700\u8981\u6790\u6784\u51fd\u6570\u3002 (RAII\u7684\u6838\u5fc3\u8981\u6c42)<\/li>\n<li>C.35: \u57fa\u7c7b\u7684\u6790\u6784\u51fd\u6570\u5e94\u8be5\u662f\u516c\u5171\u865a\u51fd\u6570\u6216\u53d7\u4fdd\u62a4\u975e\u865a\u51fd\u6570\u3002 (\u786e\u4fdd\u591a\u6001\u5bf9\u8c61\u7684\u6b63\u786e\u9500\u6bc1)<\/li>\n<\/ul>\n<h3>2. \u667a\u80fd\u6307\u9488&#xff1a;\u7ba1\u7406\u52a8\u6001\u5185\u5b58\u7684RAII\u5305\u88c5\u5668<\/h3>\n<p>\u624b\u52a8\u4f7f\u7528new\u548cdelete\u7ba1\u7406\u52a8\u6001\u5185\u5b58\u662f\u8d44\u6e90\u7ba1\u7406\u4e2d\u6700\u5e38\u89c1\u7684\u75db\u70b9\u3002\u667a\u80fd\u6307\u9488\u662f\u6807\u51c6\u5e93\u63d0\u4f9b\u7684\u7c7b\u6a21\u677f&#xff0c;\u5b9e\u73b0\u4e86\u5bf9\u52a8\u6001\u5206\u914d\u5bf9\u8c61\u7684\u81ea\u52a8\u5185\u5b58\u7ba1\u7406&#xff08;RAII\u7684\u4e00\u79cd\u5177\u4f53\u5e94\u7528&#xff09;\u3002<\/p>\n<h4>\u6838\u5fc3\u7c7b\u578b<\/h4>\n<li>\n<p>std::unique_ptr&lt;T&gt; (\u72ec\u5360\u6240\u6709\u6743\u6307\u9488)<\/p>\n<ul>\n<li>\u6240\u6709\u6743&#xff1a;\u72ec\u5360\u6240\u6307\u5411\u5bf9\u8c61\u7684\u6240\u6709\u6743\u3002unique_ptr\u9500\u6bc1\u65f6&#xff0c;\u5176\u7ba1\u7406\u7684\u5bf9\u8c61\u4e5f\u4f1a\u88ab\u9500\u6bc1\u3002<\/li>\n<li>\u62f7\u8d1d\/\u8d4b\u503c&#xff1a;\u4e0d\u53ef\u62f7\u8d1d&#xff0c;\u4e0d\u53ef\u8d4b\u503c\u3002\u8fd9\u786e\u4fdd\u4e86\u6240\u6709\u6743\u7684\u552f\u4e00\u6027\u3002<\/li>\n<li>\u79fb\u52a8&#xff1a;\u652f\u6301\u79fb\u52a8\u8bed\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7std::move\u8f6c\u79fb\u6240\u6709\u6743\u3002<\/li>\n<li>\u9002\u7528\u573a\u666f&#xff1a;\n<ul>\n<li>\u7ba1\u7406\u5177\u6709\u660e\u786e\u5355\u4e00\u6240\u6709\u8005\u7684\u8d44\u6e90&#xff08;\u6700\u5e38\u89c1\u7684\u60c5\u51b5&#xff09;\u3002<\/li>\n<li>\u4f5c\u4e3a\u5de5\u5382\u51fd\u6570\u7684\u8fd4\u56de\u503c\u3002<\/li>\n<li>\u5728\u5bb9\u5668&#xff08;\u5982std::vector&#xff09;\u4e2d\u5b58\u50a8\u52a8\u6001\u5206\u914d\u7684\u5bf9\u8c61\u3002<\/li>\n<li>\u5b9e\u73b0 Pimpl (Pointer to Implementation) \u60ef\u7528\u6cd5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u521b\u5efa&#xff1a;\u4f18\u5148\u4f7f\u7528 std::make_unique&lt;T&gt;(args&#8230;) (C&#043;&#043;14\u8d77)\u3002\u5b83\u66f4\u5b89\u5168&#xff08;\u9632\u6b62\u67d0\u4e9b\u5f02\u5e38\u5b89\u5168\u95ee\u9898&#xff09;&#xff0c;\u66f4\u9ad8\u6548&#xff08;\u51cf\u5c11\u4e00\u6b21\u5185\u5b58\u5206\u914d&#xff09;&#xff0c;\u4e14\u8bed\u6cd5\u66f4\u7b80\u6d01\u3002<\/li>\n<li>\u91ca\u653e\u8d44\u6e90&#xff1a;\u81ea\u52a8\u5728\u6790\u6784\u65f6\u8c03\u7528 delete \u6216\u81ea\u5b9a\u4e49\u7684\u5220\u9664\u5668\u3002<\/li>\n<\/ul>\n<p>\/\/ \u5de5\u5382\u51fd\u6570\u8fd4\u56de unique_ptr<br \/>\nstd::unique_ptr&lt;MyClass&gt; createObject() {<br \/>\n    return std::make_unique&lt;MyClass&gt;(\/* args *\/);<br \/>\n}<\/p>\n<p>void example() {<br \/>\n    auto ptr &#061; std::make_unique&lt;int&gt;(42); \/\/ \u521b\u5efa\u5e76\u7ba1\u7406\u4e00\u4e2a int<br \/>\n    \/\/ &#8230; \u4f7f\u7528 ptr<br \/>\n    \/\/ \u79bb\u5f00\u4f5c\u7528\u57df&#xff0c;ptr \u88ab\u9500\u6bc1&#xff0c;\u5b83\u7ba1\u7406\u7684 int \u88ab\u81ea\u52a8\u5220\u9664<br \/>\n    \/\/ \u4e0d\u80fd\u62f7\u8d1d unique_ptr<br \/>\n    \/\/ auto ptr2 &#061; ptr; \/\/ \u9519\u8bef&#xff01;<br \/>\n    auto ptr3 &#061; std::move(ptr); \/\/ \u6b63\u786e&#xff1a;\u6240\u6709\u6743\u8f6c\u79fb\u7ed9 ptr3, ptr \u53d8\u4e3a\u7a7a<br \/>\n}<\/p>\n<\/li>\n<li>\n<p>std::shared_ptr&lt;T&gt; (\u5171\u4eab\u6240\u6709\u6743\u6307\u9488)<\/p>\n<ul>\n<li>\u6240\u6709\u6743&#xff1a;\u591a\u4e2a shared_ptr \u53ef\u4ee5\u5171\u4eab\u540c\u4e00\u4e2a\u5bf9\u8c61\u7684\u6240\u6709\u6743\u3002\u5bf9\u8c61\u5728\u5176\u6700\u540e\u4e00\u4e2a shared_ptr \u88ab\u9500\u6bc1\u65f6\u624d\u4f1a\u88ab\u9500\u6bc1\u3002<\/li>\n<li>\u5185\u90e8\u673a\u5236&#xff1a;\u4f7f\u7528\u5f15\u7528\u8ba1\u6570\u8ddf\u8e2a\u6709\u591a\u5c11\u4e2a shared_ptr \u6307\u5411\u540c\u4e00\u4e2a\u5bf9\u8c61\u3002<\/li>\n<li>\u62f7\u8d1d\/\u8d4b\u503c&#xff1a;\u652f\u6301\u62f7\u8d1d\u548c\u8d4b\u503c\u3002\u62f7\u8d1d\u4f1a\u589e\u52a0\u5f15\u7528\u8ba1\u6570\u3002<\/li>\n<li>\u9002\u7528\u573a\u666f&#xff1a;\n<ul>\n<li>\u9700\u8981\u591a\u4e2a\u90e8\u5206\u4ee3\u7801\u5171\u4eab\u8bbf\u95ee\u540c\u4e00\u5bf9\u8c61&#xff0c;\u4e14\u65e0\u6cd5\u660e\u786e\u54ea\u4e2a\u90e8\u5206\u62e5\u6709\u6700\u957f\u751f\u547d\u5468\u671f\u65f6&#xff08;\u8c28\u614e\u4f7f\u7528&#xff0c;\u4f18\u5148\u8003\u8651 unique_ptr&#xff09;\u3002<\/li>\n<li>\u5728\u5bb9\u5668\u4e2d\u5b58\u50a8\u5171\u4eab\u5bf9\u8c61\u3002<\/li>\n<li>\u9700\u8981\u5c06 this \u6307\u9488\u4f5c\u4e3a shared_ptr \u4f20\u9012\u65f6&#xff08;\u4f7f\u7528 std::enable_shared_from_this&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u521b\u5efa&#xff1a;\u4f18\u5148\u4f7f\u7528 std::make_shared&lt;T&gt;(args&#8230;)\u3002\u5b83\u901a\u5e38\u66f4\u9ad8\u6548&#xff08;\u5c06\u5bf9\u8c61\u548c\u63a7\u5236\u5757\u5206\u914d\u5728\u8fde\u7eed\u5185\u5b58\u4e2d&#xff09;\u3002<\/li>\n<li>\u6ce8\u610f&#xff1a;\u8b66\u60d5\u5faa\u73af\u5f15\u7528\u3002\u5982\u679c\u4e24\u4e2a\u6216\u591a\u4e2a shared_ptr \u76f8\u4e92\u5f15\u7528&#xff08;\u4f8b\u5982&#xff0c;\u5bf9\u8c61A\u6301\u6709\u6307\u5411\u5bf9\u8c61B\u7684shared_ptr&#xff0c;\u5bf9\u8c61B\u6301\u6709\u6307\u5411\u5bf9\u8c61A\u7684shared_ptr&#xff09;&#xff0c;\u5b83\u4eec\u7684\u5f15\u7528\u8ba1\u6570\u6c38\u8fdc\u4e0d\u4f1a\u964d\u52300&#xff0c;\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u3002\u89e3\u51b3\u65b9\u6cd5&#xff1a;\u4f7f\u7528 std::weak_ptr\u3002<\/li>\n<\/ul>\n<p>class Node;<br \/>\nusing NodePtr &#061; std::shared_ptr&lt;Node&gt;;<br \/>\nclass Node {<br \/>\npublic:<br \/>\n    std::vector&lt;NodePtr&gt; children;<br \/>\n    NodePtr parent; \/\/ \u53ef\u80fd\u5bfc\u81f4\u5faa\u73af\u5f15\u7528&#xff01;\u66f4\u597d\u7684\u505a\u6cd5\u662f\u4f7f\u7528 weak_ptr<br \/>\n    \/\/ &#8230;<br \/>\n};<\/p>\n<\/li>\n<li>\n<p>std::weak_ptr&lt;T&gt; (\u5f31\u5f15\u7528\u6307\u9488)<\/p>\n<ul>\n<li>\u76ee\u7684&#xff1a;\u89e3\u51b3 shared_ptr \u7684\u5faa\u73af\u5f15\u7528\u95ee\u9898\u3002<\/li>\n<li>\u7279\u6027&#xff1a;\u4e0d\u589e\u52a0\u5bf9\u8c61\u7684\u5f15\u7528\u8ba1\u6570\u3002\u5b83\u6307\u5411\u4e00\u4e2a\u7531 shared_ptr \u7ba1\u7406\u7684\u5bf9\u8c61&#xff0c;\u4f46\u4e0d\u4f1a\u963b\u6b62\u8be5\u5bf9\u8c61\u88ab\u9500\u6bc1\u3002<\/li>\n<li>\u4f7f\u7528&#xff1a;\u4e0d\u80fd\u76f4\u63a5\u8bbf\u95ee\u5bf9\u8c61\u3002\u9700\u8981\u901a\u8fc7\u8c03\u7528 lock() \u6210\u5458\u51fd\u6570\u5c1d\u8bd5\u83b7\u53d6\u4e00\u4e2a\u4e34\u65f6\u7684 shared_ptr\u3002\u5982\u679c\u5e95\u5c42\u5bf9\u8c61\u5df2\u88ab\u9500\u6bc1&#xff0c;lock() \u8fd4\u56de\u4e00\u4e2a\u7a7a\u7684 shared_ptr\u3002<\/li>\n<li>\u9002\u7528\u573a\u666f&#xff1a;\n<ul>\n<li>\u6253\u7834 shared_ptr \u7684\u5faa\u73af\u5f15\u7528&#xff08;\u4f8b\u5982&#xff0c;\u7236\u8282\u70b9\u6301\u6709\u5b50\u8282\u70b9\u7684 shared_ptr&#xff0c;\u5b50\u8282\u70b9\u6301\u6709\u7236\u8282\u70b9\u7684 weak_ptr&#xff09;\u3002<\/li>\n<li>\u89c2\u5bdf\u4e00\u4e2a\u53ef\u80fd\u968f\u65f6\u88ab\u9500\u6bc1\u7684\u5bf9\u8c61&#xff08;\u7f13\u5b58\u3001\u76d1\u542c\u5668\u7b49&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>class Node {<br \/>\npublic:<br \/>\n    std::vector&lt;std::shared_ptr&lt;Node&gt;&gt; children;<br \/>\n    std::weak_ptr&lt;Node&gt; parent; \/\/ \u4f7f\u7528 weak_ptr \u907f\u514d\u5faa\u73af\u5f15\u7528<br \/>\n    \/\/ &#8230;<br \/>\n    std::shared_ptr&lt;Node&gt; getParent() const {<br \/>\n        return parent.lock(); \/\/ \u5c1d\u8bd5\u83b7\u53d6 shared_ptr<br \/>\n    }<br \/>\n};<\/p>\n<\/li>\n<h4>\u667a\u80fd\u6307\u9488\u6700\u4f73\u5b9e\u8df5 (C&#043;&#043; Core Guidelines)<\/h4>\n<ul>\n<li>R.11: \u907f\u514d\u663e\u5f0f\u8c03\u7528 new \u548c delete\u3002 (\u4f7f\u7528\u667a\u80fd\u6307\u9488\u6216\u5bb9\u5668)<\/li>\n<li>R.20: \u4f18\u5148\u4f7f\u7528 unique_ptr \u6216 shared_ptr \u6765\u8868\u793a\u6240\u6709\u6743\u3002 (\u660e\u786e\u8d44\u6e90\u6240\u6709\u6743\u5173\u7cfb)<\/li>\n<li>R.21: \u4f18\u5148\u4f7f\u7528 unique_ptr \u800c\u4e0d\u662f shared_ptr&#xff0c;\u9664\u975e\u4f60\u9700\u8981\u5171\u4eab\u6240\u6709\u6743\u3002 (\u72ec\u5360\u6240\u6709\u6743\u66f4\u7b80\u5355\u3001\u66f4\u9ad8\u6548)<\/li>\n<li>R.22: \u4f7f\u7528 make_shared() \u521b\u5efa shared_ptr\u3002 (\u6548\u7387\u66f4\u9ad8)<\/li>\n<li>R.23: \u4f7f\u7528 make_unique() \u521b\u5efa unique_ptr\u3002 (C&#043;&#043;14\u8d77&#xff0c;\u66f4\u5b89\u5168\u9ad8\u6548)<\/li>\n<li>R.24: \u4f7f\u7528 std::weak_ptr \u6765\u6253\u7834 shared_ptr \u7684\u5faa\u73af\u5f15\u7528\u3002 (\u9632\u6b62\u5185\u5b58\u6cc4\u6f0f)<\/li>\n<li>F.60: \u5f53\u201c\u65e0\u6240\u6709\u6743\u201d\u662f\u66f4\u597d\u7684\u9009\u62e9\u65f6&#xff0c;\u4f18\u5148\u4f7f\u7528 T* \u6216 T&amp; \u800c\u4e0d\u662f\u667a\u80fd\u6307\u9488\u3002 (\u51fd\u6570\u53c2\u6570\u4f20\u9012\u89c2\u5bdf\u8005\u65f6)<\/li>\n<li>I.11: \u6c38\u8fdc\u4e0d\u8981\u4f20\u9012\u539f\u59cb\u6307\u9488&#xff08;T*&#xff09;\u6216\u5f15\u7528&#xff08;T&amp;&#xff09;\u4f5c\u4e3a\u6240\u6709\u6743\u8f6c\u79fb\u7684\u8f7d\u4f53\u3002 (\u4f7f\u7528\u667a\u80fd\u6307\u9488\u6216\u660e\u786e\u6587\u6863\u8bf4\u660e)<\/li>\n<li>ES.65: \u4e0d\u8981\u89e3\u5f15\u7528\u65e0\u6548\u6307\u9488&#xff08;\u5982\u7a7a\u6307\u9488\u3001\u5df2\u5220\u9664\u5bf9\u8c61\u7684\u6307\u9488&#xff09;\u3002 (\u667a\u80fd\u6307\u9488\u6709\u52a9\u4e8e\u907f\u514d)<\/li>\n<li>C.149: \u4f7f\u7528 make_unique \u548c make_shared \u800c\u4e0d\u662f new \u6765\u6784\u9020\u5bf9\u8c61\u3002 (\u907f\u514d\u663e\u5f0f new)<\/li>\n<li>C.150: \u5f53\u7c7b\u9700\u8981\u5171\u4eab\u6240\u6709\u6743\u65f6&#xff0c;\u4f7f\u7528 shared_ptr \u800c\u4e0d\u662f\u81ea\u5df1\u5b9e\u73b0\u5f15\u7528\u8ba1\u6570\u3002 (\u907f\u514d\u91cd\u590d\u9020\u8f6e\u5b50)<\/li>\n<li>C.152: \u6c38\u8fdc\u4e0d\u8981\u5c06 shared_ptr \u7684\u6307\u9488\u8d4b\u503c\u7ed9 auto_ptr\u3002 (\u5df2\u5e9f\u5f03&#xff0c;\u4f46\u539f\u5219\u662f\u4e0d\u8981\u6df7\u5408\u4e0d\u540c\u6240\u6709\u6743\u7684\u667a\u80fd\u6307\u9488)<\/li>\n<\/ul>\n<h4>\u5173\u952e\u8981\u70b9\u603b\u7ed3<\/h4>\n<li>\u62e5\u62b1RAII&#xff1a;\u5c06\u8d44\u6e90\u5c01\u88c5\u5728\u7c7b\u4e2d&#xff0c;\u5229\u7528\u6784\u9020\u51fd\u6570\u83b7\u53d6\u8d44\u6e90&#xff0c;\u6790\u6784\u51fd\u6570\u91ca\u653e\u8d44\u6e90\u3002\u8fd9\u662fC&#043;&#043;\u8d44\u6e90\u7ba1\u7406\u7684\u6838\u5fc3\u54f2\u5b66\u3002<\/li>\n<li>\u4f18\u5148\u4f7f\u7528 unique_ptr&#xff1a;\u5bf9\u4e8e\u7edd\u5927\u591a\u6570\u52a8\u6001\u5185\u5b58\u5206\u914d&#xff0c;std::unique_ptr \u662f\u9996\u9009\u3002\u5b83\u7b80\u5355\u3001\u9ad8\u6548&#xff0c;\u660e\u786e\u8868\u8fbe\u4e86\u6240\u6709\u6743\u8f6c\u79fb\u3002<\/li>\n<li>\u8c28\u614e\u4f7f\u7528 shared_ptr&#xff1a;\u4ec5\u5728\u771f\u6b63\u9700\u8981\u5171\u4eab\u6240\u6709\u6743\u65f6\u4f7f\u7528\u3002\u6ce8\u610f\u5faa\u73af\u5f15\u7528\u95ee\u9898&#xff0c;\u5e76\u9002\u65f6\u4f7f\u7528 std::weak_ptr \u6765\u89e3\u51b3\u3002<\/li>\n<li>\u907f\u514d\u88f8\u6307\u9488 (new\/delete)&#xff1a;\u663e\u5f0f\u7684 new \u548c delete \u662f\u9519\u8bef\u7684\u4e3b\u8981\u6765\u6e90\u3002\u8ba9\u667a\u80fd\u6307\u9488\u6216RAII\u5bf9\u8c61\u66ff\u4f60\u7ba1\u7406\u3002<\/li>\n<li>\u4f7f\u7528 make_unique \u548c make_shared&#xff1a;\u521b\u5efa\u667a\u80fd\u6307\u9488\u65f6\u4f18\u5148\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5382\u51fd\u6570&#xff0c;\u5b83\u4eec\u66f4\u5b89\u5168\u3001\u66f4\u9ad8\u6548\u3002<\/li>\n<li>\u9075\u5faaC&#043;&#043; Core Guidelines&#xff1a;\u8fd9\u4e9b\u6307\u5357\u6c47\u96c6\u4e86\u4e13\u5bb6\u7ecf\u9a8c&#xff0c;\u63d0\u4f9b\u4e86\u5173\u4e8e\u8d44\u6e90\u7ba1\u7406\u548c\u667a\u80fd\u6307\u9488\u4f7f\u7528\u7684\u6743\u5a01\u5efa\u8bae\u3002<\/li>\n<p>\u901a\u8fc7\u4e25\u683c\u9075\u5b88\u8fd9\u4e9bRAII\u548c\u667a\u80fd\u6307\u9488\u7684\u6700\u4f73\u5b9e\u8df5&#xff0c;\u4f60\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8C&#043;&#043;\u4ee3\u7801\u7684\u5b89\u5168\u6027\u3001\u5065\u58ee\u6027\u548c\u53ef\u7ef4\u62a4\u6027&#xff0c;\u5c06\u8d44\u6e90\u6cc4\u6f0f\u548c\u65e0\u6548\u8bbf\u95ee\u7684\u98ce\u9669\u964d\u5230\u6700\u4f4e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u7684&#xff0c;\u8fd9\u662f\u4e00\u4efd\u5173\u4e8eC\u8d44\u6e90\u7ba1\u7406\u6838\u5fc3\u5b9e\u8df5\u2014\u2014RAII\u548c\u667a\u80fd\u6307\u9488\u7684\u6307\u5357&#xff0c;\u7279\u522b\u805a\u7126\u4e8e\u73b0\u4ee3C&#xff08;C11\u53ca\u4e4b\u540e&#xff09;\u7684\u6700\u4f73\u5b9e\u8df5\u548cC Core Guidelines\u7684\u5efa\u8bae\u3002C\u8d44\u6e90\u7ba1\u7406\u7ec8\u6781\u6307\u5357&#xff1a;RAII\u4e0e\u667a\u80fd\u6307\u9488\u6700\u4f73\u5b9e\u8df5\u5728C\u4e2d&#xff0c;\u624b\u52a8\u7ba1\u7406\u8d44\u6e90&#xff08;\u5982\u52a8\u6001\u5185\u5b58\u3001\u6587\u4ef6\u53e5\u67c4\u3001\u7f51\u7edc\u8fde\u63a5\u3001\u9501\u7b49&#xff09;\u662f\u590d\u6742\u4e14\u6613\u9519\u7684\u6765\u6e90\u3002\u8d44\u6e90\u6cc4\u6f0f&#xff08;\u5fd8\u8bb0\u91ca\u653e&#xff09;\u548c\u65e0\u6548\u8bbf\u95ee&#xff08;\u91ca\u653e\u540e\u4f7f\u7528&amp;#x<\/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":[99,426,190],"topic":[],"class_list":["post-61170","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-jvm","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\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\/61170.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u597d\u7684&#xff0c;\u8fd9\u662f\u4e00\u4efd\u5173\u4e8eC\u8d44\u6e90\u7ba1\u7406\u6838\u5fc3\u5b9e\u8df5\u2014\u2014RAII\u548c\u667a\u80fd\u6307\u9488\u7684\u6307\u5357&#xff0c;\u7279\u522b\u805a\u7126\u4e8e\u73b0\u4ee3C&#xff08;C11\u53ca\u4e4b\u540e&#xff09;\u7684\u6700\u4f73\u5b9e\u8df5\u548cC Core Guidelines\u7684\u5efa\u8bae\u3002C\u8d44\u6e90\u7ba1\u7406\u7ec8\u6781\u6307\u5357&#xff1a;RAII\u4e0e\u667a\u80fd\u6307\u9488\u6700\u4f73\u5b9e\u8df5\u5728C\u4e2d&#xff0c;\u624b\u52a8\u7ba1\u7406\u8d44\u6e90&#xff08;\u5982\u52a8\u6001\u5185\u5b58\u3001\u6587\u4ef6\u53e5\u67c4\u3001\u7f51\u7edc\u8fde\u63a5\u3001\u9501\u7b49&#xff09;\u662f\u590d\u6742\u4e14\u6613\u9519\u7684\u6765\u6e90\u3002\u8d44\u6e90\u6cc4\u6f0f&#xff08;\u5fd8\u8bb0\u91ca\u653e&#xff09;\u548c\u65e0\u6548\u8bbf\u95ee&#xff08;\u91ca\u653e\u540e\u4f7f\u7528&amp;#x\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/61170.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-16T23:17:35+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=\"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\/61170.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/61170.html\",\"name\":\"C++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-16T23:17:35+00:00\",\"dateModified\":\"2026-01-16T23:17:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/61170.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/61170.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/61170.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\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++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\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\/61170.html","og_locale":"zh_CN","og_type":"article","og_title":"C++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u597d\u7684&#xff0c;\u8fd9\u662f\u4e00\u4efd\u5173\u4e8eC\u8d44\u6e90\u7ba1\u7406\u6838\u5fc3\u5b9e\u8df5\u2014\u2014RAII\u548c\u667a\u80fd\u6307\u9488\u7684\u6307\u5357&#xff0c;\u7279\u522b\u805a\u7126\u4e8e\u73b0\u4ee3C&#xff08;C11\u53ca\u4e4b\u540e&#xff09;\u7684\u6700\u4f73\u5b9e\u8df5\u548cC Core Guidelines\u7684\u5efa\u8bae\u3002C\u8d44\u6e90\u7ba1\u7406\u7ec8\u6781\u6307\u5357&#xff1a;RAII\u4e0e\u667a\u80fd\u6307\u9488\u6700\u4f73\u5b9e\u8df5\u5728C\u4e2d&#xff0c;\u624b\u52a8\u7ba1\u7406\u8d44\u6e90&#xff08;\u5982\u52a8\u6001\u5185\u5b58\u3001\u6587\u4ef6\u53e5\u67c4\u3001\u7f51\u7edc\u8fde\u63a5\u3001\u9501\u7b49&#xff09;\u662f\u590d\u6742\u4e14\u6613\u9519\u7684\u6765\u6e90\u3002\u8d44\u6e90\u6cc4\u6f0f&#xff08;\u5fd8\u8bb0\u91ca\u653e&#xff09;\u548c\u65e0\u6548\u8bbf\u95ee&#xff08;\u91ca\u653e\u540e\u4f7f\u7528&amp;#x","og_url":"https:\/\/www.wsisp.com\/helps\/61170.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-16T23:17:35+00:00","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\/61170.html","url":"https:\/\/www.wsisp.com\/helps\/61170.html","name":"C++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-16T23:17:35+00:00","dateModified":"2026-01-16T23:17:35+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/61170.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/61170.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/61170.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C++\u8d44\u6e90\u7ba1\u7406\uff1aRAII\u4e0e\u667a\u80fd\u6307\u9488\u7ec8\u6781\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\/61170","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=61170"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/61170\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=61170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=61170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=61170"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=61170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}