{"id":6823,"date":"2018-04-06T19:19:28","date_gmt":"2018-04-06T10:19:28","guid":{"rendered":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6823"},"modified":"2018-04-06T19:21:59","modified_gmt":"2018-04-06T10:21:59","slug":"stdmake_shared-%e3%82%92-stdbind-%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6823","title":{"rendered":"std::make_shared \u3092 std::bind \u3059\u308b"},"content":{"rendered":"<p>\u4f55\u3082\u8003\u3048\u305a\u306b std::make_shared \u3092 std::bind \u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<blockquote>\n<pre>\r\nstruct A {\r\n    A(int) {};\r\n};\r\n\r\nint main()\r\n{\r\n    auto fn = std::bind(std::make_shared&lt;A&gt;, 1); \/\/ A::A() \u3092\u547c\u307c\u3046\u3068\u3057\u3066\u30a8\u30e9\u30fc\r\n}\r\n<\/pre>\n<\/blockquote>\n<p>\u56de\u907f\u65b9\u6cd5\u306f make_shared \u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5f15\u6570 Args \u306e\u90e8\u5206\u306b make_shared \u306e\u5f15\u6570\u306e\u578b\u3092\u660e\u793a\u7684\u306b\u66f8\u304f\u3053\u3068\u3002<\/p>\n<blockquote>\n<pre>\r\n    auto fn = std::bind(std::make_shared&lt;A, int&gt;, 1); \/\/ A::A(int) \u3092\u547c\u307c\u3046\u3068\u3057\u3066OK\r\n<\/pre>\n<\/blockquote>\n<p>\u306a\u3093\u3067\u3053\u3046\u306a\u308b\u306e\u304b\u3068\u3044\u3046\u3068\u3001 <code>std::make_shared&lt;A&gt;(1)<\/code> \u3068\u95a2\u6570\u547c\u3073\u51fa\u3057\u3067\u66f8\u3044\u305f\u5834\u5408\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5f15\u6570 Args \u306f\u5f15\u6570\u304b\u3089\u63a8\u8ad6\u3055\u308c\u308b\u304c\u3001\u4e0a\u306e\u3088\u3046\u306a\u4f7f\u3044\u65b9\u3060\u3068\u76f4\u63a5\u7684\u306a\u95a2\u6570\u547c\u3073\u51fa\u3057\u3067\u306f\u306a\u3044\u306e\u3067\u63a8\u8ad6\u3055\u308c\u305a\u3001Args \u306f\u7a7a\u3001\u3064\u307e\u308a\u30c7\u30d5\u30a9\u30eb\u30c8\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u547c\u3076 make_shared \u306b\u306a\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u4e00\u822c\u5316\u3057\u3066\u3001\u95a2\u6570\u5f15\u6570\u304b\u3089\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5f15\u6570\u3092\u63a8\u8ad6\u3059\u308b\u3088\u3046\u306a\u95a2\u6570\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092 std::bind \u3059\u308b\u5834\u5408\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f55\u3082\u8003\u3048\u305a\u306b std::make_shared \u3092 std::bind \u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-6823","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6823"}],"version-history":[{"count":6,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6823\/revisions"}],"predecessor-version":[{"id":6829,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6823\/revisions\/6829"}],"wp:attachment":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6823"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}