{"id":152,"date":"2017-01-08T15:34:28","date_gmt":"2017-01-08T07:34:28","guid":{"rendered":"http:\/\/zsaber.com\/blog\/?p=152"},"modified":"2019-08-26T15:50:48","modified_gmt":"2019-08-26T07:50:48","slug":"c-%e9%9d%99%e6%80%81%e6%b3%a8%e5%86%8c%e9%82%a3%e4%ba%9b%e4%ba%8b%e5%84%bf","status":"publish","type":"post","link":"http:\/\/zsaber.com\/blog\/p\/152","title":{"rendered":"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f"},"content":{"rendered":"<h1>\u57fa\u7840<\/h1>\n<p>\u4e0d\u77e5\u5404\u4f4d\u662f\u5426\u9047\u5230\u8fc7\u4e00\u4e9b\u4ee3\u7801\u9700\u8981\u9759\u6001\u6ce8\u518c\u4ec0\u4e48\u7684, \u6700\u7b80\u5355\u7c97\u66b4\u7684\u65b9\u5f0f\u5e94\u8be5\u5f88\u591a\u4eba\u90fd\u7528\u8fc7:<\/p>\n<pre><code class=\"language-cpp\">class MyInit {\npublic:\n    MyInit(void) {\n        \/\/ do init step\n    }\n    ~MyInit(void) {\n        \/\/ do cleanup step\n    }\n};\n\/\/ in cpp files only\nstatic MyInit _init;<\/code><\/pre>\n<p>\u539f\u7406\u4e5f\u5f88\u7b80\u5355\u7c97\u66b4, \u5229\u7528\u5168\u5c40\u9759\u6001\u5bf9\u8c61, \u5728\u6784\u9020\u65f6\u8c03\u7528\u6240\u9700\u7684\u521d\u59cb\u5316\u4ee3\u7801<\/p>\n<h1>header only<\/h1>\n<p>\u4e00\u822c\u6765\u8bf4\u4e0a\u9762\u7684\u89e3\u51b3\u65b9\u6848\u5c31\u8db3\u591f\u5927\u591a\u6570\u573a\u666f\u4f7f\u7528\u4e86, \u4e0d\u8fc7\u8fd8\u6709\u4e00\u79cd\u641e\u4e0d\u5b9a\u7684\u5c31\u662f header only \u7684\u5e93,<br \/>\n\u4e0d\u5e0c\u671b\u8fd8\u5f97\u5355\u72ec\u641e\u4e2a cpp \u6765\u5b9e\u73b0, \u4e00\u662f\u9ebb\u70e6 (\u5c24\u5176\u91cf\u591a\u4e86\u4e4b\u540e), \u4e8c\u662f\u5bb9\u6613\u5fd8<\/p>\n<p>\u76f4\u63a5\u5c06\u4e0a\u8ff0\u5185\u5bb9\u653e\u5934\u6587\u4ef6\u91cc\u5176\u5b9e\u4e5f\u80fd\u8fbe\u5230\u7c7b\u4f3c\u6548\u679c, \u4f46\u662f\u6709\u660e\u663e\u7684\u95ee\u9898:<\/p>\n<ul>\n<li>\u6bcf\u4e2a\u7f16\u8bd1\u5355\u5143\u5f15\u5165\u8fd9\u4e2a\u5934\u6587\u4ef6, \u5c31\u4f1a\u751f\u6210\u4e00\u4e2a\u9759\u6001\u5bf9\u8c61\u5b9e\u4f8b<\/li>\n<li>\u7531\u4e8e\u6709\u591a\u4e2a\u9759\u6001\u5bf9\u8c61\u5b9e\u4f8b, \u4f1a\u9020\u6210\u521d\u59cb\u5316\u65b9\u6cd5\u88ab\u8c03\u7528\u591a\u6b21<br \/>\n(\u5f53\u7136\u8fd9\u4e2a\u6709\u65b9\u6cd5\u53ef\u4ee5\u7ed5\u8fc7, \u6bd4\u5982\u521d\u59cb\u5316\u65f6\u53ea\u6ce8\u518c\u51fd\u6570\u6307\u9488, \u7136\u540e\u5728\u67d0\u4e2a\u7edf\u4e00\u5165\u53e3\u6765\u8c03\u7528\u51fd\u6570\u6307\u9488\u8fdb\u884c\u521d\u59cb\u5316)<\/li>\n<li>\u5f53\u5f15\u5165\u8fd9\u4e2a\u5934\u6587\u4ef6\u7684\u7f16\u8bd1\u5355\u5143\u591a\u4e86\u4e4b\u540e, \u4f1a\u9020\u6210\u8fd9\u4e9b\u65e0\u610f\u4e49\u7684\u9759\u6001\u5bf9\u8c61\u5b9e\u4f8b\u7684\u4e2a\u6570\u7206\u70b8\u6027\u7684\u589e\u957f,<br \/>\n\u9020\u6210\u5185\u5b58\u6216\u6027\u80fd\u95ee\u9898<\/li>\n<\/ul>\n<p>\u5f53\u7136, C\u8279\u662f\u4e2a\u795e\u5947\u7684\u8bed\u8a00, \u8fd8\u662f\u6709\u65b9\u6cd5\u53ef\u4ee5\u89e3\u51b3\u8fd9\u95ee\u9898, \u7b54\u6848\u81ea\u7136\u662f C\u8279 \u795e\u5947\u7684\u6a21\u677f:<\/p>\n<pre><code class=\"language-cpp\">template&lt;typename D&gt;\nclass Wrapper {\npublic:\n    class ExecInit {\n    public:\n        ExecInit(void) {\n            \/\/ do init step\n        }\n        ~ExecInit(void) {\n            \/\/ do cleanup step\n        }\n    };\n    static ExecInit register_object;\n\n    template&lt;ExecInit &amp;&gt; class RefIt {};\n    static RefIt&lt;register_object&gt; ref_object;\n};\n\ntemplate&lt;typename D&gt;\ntypename Wrapper&lt;D&gt;::ExecInit Wrapper&lt;D&gt;::register_object;\n\nclass RefItDummy : Wrapper&lt;RefItDummy&gt; {};<\/code><\/pre>\n<ul>\n<li>\u6838\u5fc3\u539f\u7406\u548c\u4e4b\u524d\u7684\u5176\u5b9e\u6ca1\u4ec0\u4e48\u5dee\u522b, \u4e3b\u8981\u53d8\u5316\u4e4b\u4e00\u662f, \u7528\u6a21\u677f\u53bb\u5305\u88c5\u9759\u6001\u5bf9\u8c61,<br \/>\n\u4ee5\u4fbf\u80fd\u591f\u5728\u5934\u6587\u4ef6\u4e2d\u7533\u660e\u5e76\u5b9e\u4f8b\u5316<br \/>\n(\u975e\u6a21\u677f\u7684\u9759\u6001\u5bf9\u8c61, \u76f4\u63a5\u653e\u5934\u6587\u4ef6\u662f\u4f1a\u7b26\u53f7\u91cd\u5b9a\u4e49\u7684,<br \/>\n\u6a21\u677f\u5c31\u53ef\u4ee5\u4fdd\u8bc1\u6bcf\u4e2a\u7279\u5316\u53ea\u4f1a\u6709\u4e00\u4efd)<\/li>\n<li>\u591a\u4e86\u4e2a RefIt \u548c RefItDummy \u4e3b\u8981\u662f\u4e3a\u4e86\u9632\u6b62\u6a21\u677f\u6ca1\u6709\u88ab\u663e\u5f0f\u5f15\u7528\u65f6,<br \/>\n\u88ab\u7f16\u8bd1\u5668\u4f18\u5316\u6389<\/li>\n<\/ul>\n<h1>class scope<\/h1>\n<p>\u6709\u4e86\u4e0a\u8ff0 header only \u7684\u65b9\u6848, \u57fa\u672c\u4e0a\u53ef\u4ee5\u89e3\u51b3\u7edd\u5927\u591a\u6570\u9700\u6c42\u4e86, \u4f46\u662f\u5947\u8469\u9700\u6c42\u603b\u8fd8\u662f\u4f1a\u6709\u7684,<br \/>\n\u6bd4\u5982, \u5982\u4f55\u5728 class scope \u91cc\u9762\u641e?<\/p>\n<p>\u5176\u5b9e\u8fd8\u662f\u53ef\u4ee5\u7528\u540c\u4e00\u5957\u8f6e\u5b50\u518d\u641e\u4e2a\u590d\u6742\u70b9\u7684\u7248\u672c, \u5c31\u80fd\u5b9e\u73b0\u4e86:<\/p>\n<pre><code class=\"language-cpp\">\/\/ \u9996\u5148, \u5168\u5c40\u8fd8\u662f\u5f97\u8981\u6709\u4e2a wrapper\n\/\/ \u4f46\u662f\u8fd9\u56de\u6211\u4eec\u518d\u591a\u52a0\u70b9\u6599\ntemplate&lt;typename ExecWrapper&gt;\nclass Wrapper {\npublic:\n    class ExecInit {\n    public:\n        ExecInit(void) {\n            ExecWrapper::myInit();\n        }\n        ~ExecInit(void) {\n            ExecWrapper::myCleanup();\n        }\n    };\n    static ExecInit register_object;\n\n    template&lt;ExecInit &amp;&gt; class RefIt {};\n    static RefIt&lt;register_object&gt; ref_object;\n};\n\ntemplate&lt;typename ExecWrapper&gt;\ntypename Wrapper&lt;ExecWrapper&gt;::ExecInit Wrapper&lt;ExecWrapper&gt;::register_object;\n\nclass RefItDummy : Wrapper&lt;RefItDummy&gt; {\npublic:\n    static void myInit(void) {}\n    static void myCleanup(void) {}\n};<\/code><\/pre>\n<pre><code class=\"language-cpp\">\/\/ \u7136\u540e, \u7528\u540c\u6837\u7684\u5957\u8def\u6765\u4e00\u904d\u6a21\u677f\u7279\u5316, \u4ee5\u786e\u4fdd register_object \u88ab\u5b9e\u4f8b\u5316\nclass MyObject {\npublic:\n    class MyInit {\n    public:\n        static void myInit(void) {\n            \/\/ do init step\n        }\n        static void myCleanup(void) {\n            \/\/ do cleanup step\n        }\n    };\n    static Wrapper&lt;MyInit&gt; &amp;refIt(void) {\n        static Wrapper&lt;MyInit&gt; d;\n        return d;\n    }\n};\n\n\/\/ \u6ce8\u610f\u4e0a\u8ff0\u4ee3\u7801\u4e0d\u9700\u8981\u6539\u52a8\u5230\u81ea\u5df1\u539f\u5148\u7684 MyObject, \u800c\u4e14\u53ef\u4ee5\u76f4\u63a5\u5728\u91cc\u9762\u6dfb\u52a0\u4efb\u610f\u591a\u4e2a\u7684\u6ce8\u518c\u5165\u53e3\n\/\/ \u4e5f\u4e0d\u9700\u8981\u5f15\u7528\u5230 MyObject \u65f6\u624d\u4f1a\u521d\u59cb\u5316, \u53ea\u8981\u5f15\u5165\u4e86\u5934\u6587\u4ef6\u5c31\u81ea\u52a8\u4f1a\u8c03\u7528<\/code><\/pre>\n<ul>\n<li>\u5229\u7528\u7684\u8fd8\u662f\u540c\u4e00\u4e2a\u5957\u8def, \u53ea\u8981\u6a21\u677f\u7684\u7279\u5316\u7248\u672c\u88ab\u5f15\u7528, \u7279\u5316\u7248\u672c\u5185\u90e8\u7684\u9759\u6001\u5bf9\u8c61\u5c31\u4f1a\u88ab\u521d\u59cb\u5316,<br \/>\n\u5e76\u6700\u7ec8\u8c03\u7528\u6211\u4eec\u7684\u521d\u59cb\u5316\u4ee3\u7801<\/li>\n<li>\u5f53\u7136\u8fd9\u91cc\u9762\u4e5f\u6709\u4e0d\u5c11 tricks, \u6bd4\u5982\u6a21\u677f\u4e3a\u4ec0\u4e48\u8981\u5b9a\u4e49\u5728\u5168\u5c40\u8303\u56f4\u5185,<br \/>\n\u6bd4\u5982 MyInit \u4e3a\u4ec0\u4e48\u662f\u4f5c\u4e3a\u6a21\u677f\u53c2\u6570\u6765\u4f20\u9012<\/li>\n<\/ul>\n<h1>\u6ce8\u610f\u4e8b\u9879<\/h1>\n<p>\u867d\u7136\u4e0a\u8ff0\u6a21\u677f\u7684\u65b9\u5f0f\u770b\u4f3c\u5f88\u5348\u5f88\u5b8c\u7f8e, \u4f46\u662f\u81f3\u5c11\u76ee\u524d\u4e3a\u6b62\u5df2\u53d1\u73b0\u4e86\u4e2a\u5927\u5751: \u8bf7\u5c24\u5176\u6ce8\u610f\u907f\u514d\u8fc7\u5ea6\u4f9d\u8d56\u8fd9\u79cd\u65b9\u5f0f,<br \/>\n\u5426\u5219\u5728 Windows \u5e73\u53f0\u53ef\u80fd\u4f1a\u51fa\u73b0 <code>too many sections<\/code>, <code>file too big<\/code>, \u6216\u8005\u7c7b\u4f3c\u95ee\u9898<\/p>\n<p>\u81f3\u4e8e\u539f\u56e0:<\/p>\n<ul>\n<li>\u6a21\u677f\u65b9\u5f0f\u5b9e\u73b0\u4e0d\u4f1a\u51fa\u73b0\u7b26\u53f7\u91cd\u5b9a\u4e49, \u662f\u56e0\u4e3a\u6a21\u677f\u5b9e\u4f8b\u53ef\u4ee5\u5728\u94fe\u63a5\u8fc7\u7a0b\u4e2d\u88ab\u4f18\u5316\u6389<br \/>\n(\u7f16\u8bd1\u5668\u80fd\u591f\u660e\u786e\u77e5\u9053\u8fd9\u4e9b\u6a21\u677f\u5b9e\u4f8b\u662f\u76f8\u540c\u7684, \u66f4\u591a\u7684\u4e1c\u897f, \u6709\u5174\u8da3\u53ef\u4ee5\u641c\u4e00\u4e0b <code>ODR (One Defination Rule)<\/code>)<\/li>\n<li>\u7136\u800c\u5728\u7f16\u8bd1\u8fc7\u7a0b\u4e2d, \u6bcf\u4e2a cpp \u5176\u5b9e\u662f\u4f1a\u5b9e\u4f8b\u5316\u6240\u6709\u5f15\u7528\u5230\u7684\u6a21\u677f,<br \/>\n\u6240\u4ee5, \u5982\u679c\u4e00\u4e2a cpp \u5f15\u5165\u7684\u4e0a\u8ff0\u663e\u5f0f\u5b9e\u4f8b\u5316\u7684\u6a21\u677f\u591a\u4e86,<br \/>\n\u5c31\u4f1a\u9020\u6210\u8fd9\u4e2a\u7f16\u8bd1\u5355\u5143\u5185\u7684\u5bf9\u8c61\u8fc7\u591a, \u6700\u7ec8\u9020\u6210 <code>too many sections<\/code><\/li>\n<\/ul>\n<p>\u5f53\u7136:<\/p>\n<ul>\n<li>\u8fd9\u73a9\u610f\u513f\u53ea\u5728 Windows \u5e73\u53f0\u4f1a\u51fa\u73b0, \u4f3c\u4e4e\u662f\u56e0\u4e3a\u65e7\u7684 PE \u683c\u5f0f\u53ea\u6709\u4e24\u5b57\u8282\u5b58\u50a8\u5bf9\u8c61\u4e2a\u6570,<br \/>\n\u6240\u4ee5\u6700\u5927\u4e2a\u6570\u662f\u559c\u95fb\u4e50\u89c1\u7684 32768 \u5de6\u53f3\u7684\u5927\u5c0f,<br \/>\n\u5bf9\u4e8e\u91cd\u5ea6\u6a21\u677f\u7528\u6237\u6765\u8bf4, \u8fd8\u662f\u6bd4\u8f83\u5bb9\u6613\u8d85\u8fc7\u7684<br \/>\n(boost \u7528\u6237\u4e5f\u8bf7\u6ce8\u610f\u7c7b\u4f3c\u95ee\u9898, \u80a1\u6c9f\u5df2\u7ecf\u641c\u51fa\u4e0d\u5c11\u5148\u4f8b\u4e86, \u800c\u4e14\u6ca1\u6709\u4ec0\u4e48\u597d\u7684\u89e3\u51b3\u65b9\u6848)<\/li>\n<li>\u5982\u679c\u7528\u7684\u662f Visual Studio, \u8fd8\u53ef\u4ee5\u7528 <code>\/bigobj<\/code> \u7f16\u8bd1\u9009\u9879\u7ed5\u8fc7\u4e00\u4e0b,<br \/>\n\u4f46\u662f MinGW \u4e4b\u6d41\u5c31\u5b8c\u5168\u6ca1\u8f99\u4e86<\/li>\n<\/ul>\n<p>\u4e2a\u4eba\u5efa\u8bae:<\/p>\n<ul>\n<li>\u8c28\u614e\u4f7f\u7528\u8be5\u65b9\u5f0f, \u5c24\u5176\u662f\u4f60\u6709\u8ba1\u5212\u8de8\u5e73\u53f0\u7684\u65f6\u5019,<br \/>\n\u56e0\u4e3a\u5934\u6587\u4ef6\u5f04\u8fd9\u4e9b, \u662f\u5f88\u53ef\u80fd\u6c61\u67d3\u5176\u4ed6\u4ee3\u7801\u7684, \u5230\u65f6\u5019\u8981\u6536\u624b\u53ef\u4e0d\u662f\u5bb9\u6613\u7684\u4e8b<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u7840 \u4e0d\u77e5\u5404\u4f4d\u662f\u5426\u9047\u5230\u8fc7\u4e00\u4e9b\u4ee3\u7801\u9700\u8981\u9759\u6001\u6ce8\u518c\u4ec0\u4e48\u7684, \u6700\u7b80\u5355\u7c97\u66b4\u7684\u65b9\u5f0f\u5e94\u8be5\u5f88\u591a\u4eba\u90fd\u7528\u8fc7: class MyIn\u2026 <span class=\"read-more\"><a href=\"http:\/\/zsaber.com\/blog\/p\/152\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f - \u67d0Z\u7684\u535a\u5ba2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/zsaber.com\/blog\/p\/152\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f - \u67d0Z\u7684\u535a\u5ba2\" \/>\n<meta property=\"og:description\" content=\"\u57fa\u7840 \u4e0d\u77e5\u5404\u4f4d\u662f\u5426\u9047\u5230\u8fc7\u4e00\u4e9b\u4ee3\u7801\u9700\u8981\u9759\u6001\u6ce8\u518c\u4ec0\u4e48\u7684, \u6700\u7b80\u5355\u7c97\u66b4\u7684\u65b9\u5f0f\u5e94\u8be5\u5f88\u591a\u4eba\u90fd\u7528\u8fc7: class MyIn\u2026 Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"http:\/\/zsaber.com\/blog\/p\/152\" \/>\n<meta property=\"og:site_name\" content=\"\u67d0Z\u7684\u535a\u5ba2\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-08T07:34:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-26T07:50:48+00:00\" \/>\n<meta name=\"author\" content=\"Z\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Z\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/zsaber.com\/blog\/p\/152#article\",\"isPartOf\":{\"@id\":\"http:\/\/zsaber.com\/blog\/p\/152\"},\"author\":{\"name\":\"Z\",\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f\"},\"headline\":\"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f\",\"datePublished\":\"2017-01-08T07:34:28+00:00\",\"dateModified\":\"2019-08-26T07:50:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/zsaber.com\/blog\/p\/152\"},\"wordCount\":27,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f\"},\"articleSection\":[\"C++\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/zsaber.com\/blog\/p\/152#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/zsaber.com\/blog\/p\/152\",\"url\":\"http:\/\/zsaber.com\/blog\/p\/152\",\"name\":\"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f - \u67d0Z\u7684\u535a\u5ba2\",\"isPartOf\":{\"@id\":\"http:\/\/zsaber.com\/blog\/#website\"},\"datePublished\":\"2017-01-08T07:34:28+00:00\",\"dateModified\":\"2019-08-26T07:50:48+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/zsaber.com\/blog\/p\/152#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/zsaber.com\/blog\/p\/152\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/zsaber.com\/blog\/p\/152#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/zsaber.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/zsaber.com\/blog\/#website\",\"url\":\"http:\/\/zsaber.com\/blog\/\",\"name\":\"\u67d0Z\u7684\u535a\u5ba2\",\"description\":\"\u7b80\u4ecb\u53c8\u4e0d\u80fd\u5403\",\"publisher\":{\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/zsaber.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f\",\"name\":\"Z\",\"logo\":{\"@id\":\"http:\/\/zsaber.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"\u67d0Z\",\"sameAs\":[\"http:\/\/ZFFramework.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f - \u67d0Z\u7684\u535a\u5ba2","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":"http:\/\/zsaber.com\/blog\/p\/152","og_locale":"zh_CN","og_type":"article","og_title":"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f - \u67d0Z\u7684\u535a\u5ba2","og_description":"\u57fa\u7840 \u4e0d\u77e5\u5404\u4f4d\u662f\u5426\u9047\u5230\u8fc7\u4e00\u4e9b\u4ee3\u7801\u9700\u8981\u9759\u6001\u6ce8\u518c\u4ec0\u4e48\u7684, \u6700\u7b80\u5355\u7c97\u66b4\u7684\u65b9\u5f0f\u5e94\u8be5\u5f88\u591a\u4eba\u90fd\u7528\u8fc7: class MyIn\u2026 Read More &raquo;","og_url":"http:\/\/zsaber.com\/blog\/p\/152","og_site_name":"\u67d0Z\u7684\u535a\u5ba2","article_published_time":"2017-01-08T07:34:28+00:00","article_modified_time":"2019-08-26T07:50:48+00:00","author":"Z","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"Z","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/zsaber.com\/blog\/p\/152#article","isPartOf":{"@id":"http:\/\/zsaber.com\/blog\/p\/152"},"author":{"name":"Z","@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f"},"headline":"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f","datePublished":"2017-01-08T07:34:28+00:00","dateModified":"2019-08-26T07:50:48+00:00","mainEntityOfPage":{"@id":"http:\/\/zsaber.com\/blog\/p\/152"},"wordCount":27,"commentCount":0,"publisher":{"@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f"},"articleSection":["C++"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/zsaber.com\/blog\/p\/152#respond"]}]},{"@type":"WebPage","@id":"http:\/\/zsaber.com\/blog\/p\/152","url":"http:\/\/zsaber.com\/blog\/p\/152","name":"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f - \u67d0Z\u7684\u535a\u5ba2","isPartOf":{"@id":"http:\/\/zsaber.com\/blog\/#website"},"datePublished":"2017-01-08T07:34:28+00:00","dateModified":"2019-08-26T07:50:48+00:00","breadcrumb":{"@id":"http:\/\/zsaber.com\/blog\/p\/152#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/zsaber.com\/blog\/p\/152"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/zsaber.com\/blog\/p\/152#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/zsaber.com\/blog"},{"@type":"ListItem","position":2,"name":"C++ \u9759\u6001\u6ce8\u518c\u90a3\u4e9b\u4e8b\u513f"}]},{"@type":"WebSite","@id":"http:\/\/zsaber.com\/blog\/#website","url":"http:\/\/zsaber.com\/blog\/","name":"\u67d0Z\u7684\u535a\u5ba2","description":"\u7b80\u4ecb\u53c8\u4e0d\u80fd\u5403","publisher":{"@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/zsaber.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/6a6701fc719eff087e24e39a00e2280f","name":"Z","logo":{"@id":"http:\/\/zsaber.com\/blog\/#\/schema\/person\/image\/"},"description":"\u67d0Z","sameAs":["http:\/\/ZFFramework.com"]}]}},"_links":{"self":[{"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/posts\/152"}],"collection":[{"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/comments?post=152"}],"version-history":[{"count":0,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/posts\/152\/revisions"}],"wp:attachment":[{"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/media?parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/categories?post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zsaber.com\/blog\/wp-json\/wp\/v2\/tags?post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}