{"id":744,"date":"2012-11-07T11:53:36","date_gmt":"2012-11-07T02:53:36","guid":{"rendered":"http:\/\/soundengine.jp\/wordpress\/tips\/?p=744"},"modified":"2014-02-06T23:42:23","modified_gmt":"2014-02-06T14:42:23","slug":"stdtr1-shared_ptr%e3%81%ae%e6%a7%8b%e7%af%89%e3%83%bb%e7%a0%b4%e6%a3%84%e3%81%ab%e3%81%8a%e3%81%91%e3%82%8b%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9%e6%b8%ac%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/soundengine.jp\/wordpress\/tips\/try\/744\/","title":{"rendered":"std::tr1 shared_ptr\u306e\u69cb\u7bc9\u30fb\u7834\u68c4\u306b\u304a\u3051\u308b\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6e2c\u5b9a"},"content":{"rendered":"<p><a href=\"http:\/\/ja.wikipedia.org\/wiki\/Technical%20Report%201\" title=\"WikiPedia:Technical Report 1\" rel=\"nofollow\">Technical Report 1<\/a>\u3067C++\u306e\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3044\u304f\u3064\u304b\u306e\u30af\u30e9\u30b9\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u3002VisualStudio\u306eSP1\u3067\u306f\u3053\u306e<a href=\"http:\/\/msdn.microsoft.com\/ja-jp\/library\/bb982198.aspx\" rel=\"nofollow\">TR1\u304c\u63a1\u7528\u3055\u308c<\/a>\u65b0\u3057\u3044\u30af\u30e9\u30b9\u3092\u4f7f\u3046\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u524d\u306b<a href=\"http:\/\/soundengine.jp\/wordpress\/tips\/2012\/07\/17\/vc-carray%e3%80%81catlarray%e3%80%81vector%e3%80%81%e9%85%8d%e5%88%97%e3%80%81arrayccli%e3%81%ae%e9%80%9f%e5%ba%a6\/\">CArray\u3001CAtlArray\u3001vector\u3001\u914d\u5217\u3001array(C++\/CLI)\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6e2c\u5b9a<\/a>\u3068\u3044\u3046\u3053\u3068\u3092\u3084\u308a\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306f\u3001\u8ffd\u52a0\u3055\u308c\u305f\u30af\u30e9\u30b9\u306e\u5185\u30b9\u30de\u30fc\u30c8\u30dd\u30a4\u30f3\u30bf\u306e\u30af\u30e9\u30b9\u306b\u3042\u305f\u308bshared_ptr\u306b\u3064\u3044\u3066\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6e2c\u5b9a\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h2 id=\"content_1_0\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6e2c\u5b9a  <a class=\"anchor_super\" id=\"e0bff337\" href=\"http:\/\/soundengine.jp\/backend\/?services%2Ftips%2F2009-02-26#e0bff337\" title=\"e0bff337\"> <\/a><\/h2>\n<p>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6e2c\u5b9a\u3067\u306f\u3001RdTsc\u3092\u4f7f\u3063\u3066\u5e73\u5747\u7684\u306a\u30af\u30ed\u30c3\u30af\u6570\u3092\u6e2c\u5b9a\u3059\u308b\u3002\u6e2c\u5b9a\u306f\u3001Windows XP\/Core 2 Duo\u306ePC\u3067\u884c\u3063\u305f\u3002shared_ptr\u306b\u4ed8\u3051\u52a0\u3048\u3001\u81ea\u52d5\u5909\u6570\u30fbnew\/delete\u30fbauto_ptr\u30fbCAutoPtr\u30fbvector&lt;shared_ptr&gt;\u30fb<a href=\"http:\/\/soundengine.jp\/wordpress\/tips\/2012\/07\/09\/visual-studio-20052008-%e3%82%a6%e3%82%aa%e3%83%83%e3%83%81%e3%81%abcautoptrarray%e3%81%ae%e4%b8%ad%e8%ba%ab%e8%a1%a8%e7%a4%ba\/\">CAutoPtrArray<\/a>\u306b\u3064\u3044\u3066CString\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u7bc9\u30fb\u7834\u68c4\u306b\u5bfe\u3057\u3066\u8abf\u67fb\u3057\u305f\u3002<\/p>\n<div class=\"jumpmenu\">\n<\/div>\n<h3 id=\"content_1_1\">\u4e00\u3064\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u7bc9\u30fb\u7834\u68c4  <a class=\"anchor_super\" id=\"d1bdd27d\" href=\"http:\/\/soundengine.jp\/backend\/?services%2Ftips%2F2009-02-26#d1bdd27d\" title=\"d1bdd27d\"> <\/a><\/h3>\n<p>1\u3064\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u69cb\u7bc9\u3057\u305d\u308c\u3092\u7834\u68c4\u3059\u308b\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306e\u6e2c\u5b9a\u3002<\/p>\n<div class=\"ie5\">\n<table class=\"style_table\" border=\"0\" cellspacing=\"1\">\n<tbody>\n<tr>\n<th class=\"style_th\">\u30b3\u30fc\u30c9<\/th>\n<th class=\"style_th\">\u30af\u30ed\u30c3\u30af\u6570<\/th>\n<th class=\"style_th\">\u901f\u5ea6(%)<\/th>\n<\/tr>\n<tr>\n<td class=\"style_td\">auto CString()<\/td>\n<td class=\"style_td\" style=\"text-align:right\">85<\/td>\n<td class=\"style_td\" style=\"text-align:right\">100<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">delete new CString();<\/td>\n<td class=\"style_td\" style=\"text-align:right\">398<\/td>\n<td class=\"style_td\" style=\"text-align:right\">21.4<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">CAutoPtr &lt; CString &gt; ( new CString() );<\/td>\n<td class=\"style_td\" style=\"text-align:right\">399<\/td>\n<td class=\"style_td\" style=\"text-align:right\">21.4<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">auto_ptr &lt; CString &gt; ( new CString() );<\/td>\n<td class=\"style_td\" style=\"text-align:right\">399<\/td>\n<td class=\"style_td\" style=\"text-align:right\">21.3<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">shared_ptr &lt; CString &gt; ( new CString() );<\/td>\n<td class=\"style_td\" style=\"text-align:right\">914<\/td>\n<td class=\"style_td\" style=\"text-align:right\">9.3<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">shared_ptr &lt; CString &gt; p1( new CString() );<br class=\"spacer\">shared_ptr &lt; CString &gt; p2( p1 );<\/td>\n<td class=\"style_td\" style=\"text-align:right\">1016<\/td>\n<td class=\"style_td\" style=\"text-align:right\">8.4<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">shared_ptr &lt; CString &gt; p1( new CString() );<br class=\"spacer\">weak_ptr &lt; CString &gt; p2( p1 );<br class=\"spacer\">p2.lock();<\/td>\n<td class=\"style_td\" style=\"text-align:right\">1060<\/td>\n<td class=\"style_td\" style=\"text-align:right\">8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u81ea\u52d5\u5909\u6570\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u5834\u5408\u3068\u6bd4\u3079\u3001shared_ptr\u306e\u69cb\u7bc9\u30fb\u7834\u68c4\u306b10\u500d\u4ee5\u4e0a\u306e\u30af\u30ed\u30c3\u30af\u6570\u304c\u304b\u304b\u3063\u3066\u3044\u308b\u3002\u307e\u305f\u3001CAutoPtr\u3084auto_ptr\u306b\u6bd4\u30792.3\u500d\u306e\u30af\u30ed\u30c3\u30af\u6570\u304c\u304b\u304b\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u3002<\/p>\n<div class=\"jumpmenu\">\n<\/div>\n<h3 id=\"content_1_2\">\u8907\u6570\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u7bc9\u30fb\u7834\u68c4  <a class=\"anchor_super\" id=\"id1e96b5\" href=\"http:\/\/soundengine.jp\/backend\/?services%2Ftips%2F2009-02-26#id1e96b5\" title=\"id1e96b5\"> <\/a><\/h3>\n<p>5\u3064\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u69cb\u7bc9\u3057\u305d\u308c\u3092\u30b9\u30de\u30fc\u30c8\u30dd\u30a4\u30f3\u30bf\u306e\u30ea\u30b9\u30c8\u306b\u8ffd\u52a0\u3059\u308b\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306e\u6e2c\u5b9a\u3002<\/p>\n<div class=\"ie5\">\n<table class=\"style_table\" border=\"0\" cellspacing=\"1\">\n<tbody>\n<tr>\n<th class=\"style_th\">\u30b3\u30fc\u30c9<\/th>\n<th class=\"style_th\">\u30af\u30ed\u30c3\u30af\u6570<\/th>\n<th class=\"style_th\">\u901f\u5ea6(%)<\/th>\n<\/tr>\n<tr>\n<td class=\"style_td\">CString s[ 5 ];<\/td>\n<td class=\"style_td\" style=\"text-align:right\">498<\/td>\n<td class=\"style_td\" style=\"text-align:right\">100<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">delete new CString();<br class=\"spacer\">delete new CString();<br class=\"spacer\">delete new CString();<br class=\"spacer\">delete new CString();<br class=\"spacer\">delete new CString();<\/td>\n<td class=\"style_td\" style=\"text-align:right\">1975<\/td>\n<td class=\"style_td\" style=\"text-align:right\">25.2<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">CAutoPtrArray &lt; CString &gt; a;<br class=\"spacer\">a.Add( CAutoPtr &lt; CString &gt; ( new CString() ) );<br class=\"spacer\">a.Add( CAutoPtr &lt; CString &gt; ( new CString() ) );<br class=\"spacer\">a.Add( CAutoPtr &lt; CString &gt; ( new CString() ) );<br class=\"spacer\">a.Add( CAutoPtr &lt; CString &gt; ( new CString() ) );<br class=\"spacer\">a.Add( CAutoPtr &lt; CString &gt; ( new CString() ) );<\/td>\n<td class=\"style_td\" style=\"text-align:right\">3173<\/td>\n<td class=\"style_td\" style=\"text-align:right\">15.7<\/td>\n<\/tr>\n<tr>\n<td class=\"style_td\">vector &lt; shared_ptr &lt; CString &gt; &gt; v;<br class=\"spacer\">v.push_back( shared_ptr &lt; CString &gt; ( new CString() ) );<br class=\"spacer\">v.push_back( shared_ptr &lt; CString &gt; ( new CString() ) );<br class=\"spacer\">v.push_back( shared_ptr &lt; CString &gt; ( new CString() ) );<br class=\"spacer\">v.push_back( shared_ptr &lt; CString &gt; ( new CString() ) );<br class=\"spacer\">v.push_back( shared_ptr &lt; CString &gt; ( new CString() ) );<\/td>\n<td class=\"style_td\" style=\"text-align:right\">9382<\/td>\n<td class=\"style_td\" style=\"text-align:right\">5.3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>CAutoPtrArray\u3068\u6bd4\u3079vetor&lt;shared_ptr&gt;\u306e\u69cb\u7bc9\u30fb\u7834\u68c4\u306b\u7d043\u500d\u306e\u30af\u30ed\u30c3\u30af\u6570\u304c\u304b\u304b\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u3002<\/p>\n<p>\u7d50\u679c\u3068\u3057\u3066\u306f\u3001\u4f55\u5ea6\u3082\u69cb\u7bc9\u30fb\u7834\u68c4\u3059\u308b\u3088\u3046\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u81ea\u52d5\u5909\u6570\u3067\u5272\u308a\u5f53\u3066\u308b\u306e\u304c\u3082\u3063\u3068\u3082\u901f\u5ea6\u304c\u65e9\u3044\u3053\u3068\u304c\u308f\u304b\u308b\u3002\u307e\u305f\u3001\u4e00\u5ea6\u3057\u304b\u69cb\u7bc9\u3057\u306a\u3044\u3082\u306e\u306b\u3064\u3044\u3066\u306f\u305d\u308c\u305e\u308c\u30af\u30ed\u30c3\u30af\u6570\u306b\u5dee\u306f\u3042\u308b\u3082\u306e\u306e\u5168\u822c\u7684\u306b\u5927\u3057\u305f\u30af\u30ed\u30c3\u30af\u6570\u3067\u306f\u306a\u3044\u306e\u3067\u3001\u597d\u304d\u306a\u3082\u306e\u3092\u9078\u629e\u3059\u308b\u306e\u304c\u3088\u3044\u3053\u3068\u304c\u308f\u304b\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Technical Report 1\u3067C++\u306e\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3044\u304f\u3064\u304b\u306e\u30af\u30e9\u30b9\u304c &hellip; <a href=\"https:\/\/soundengine.jp\/wordpress\/tips\/try\/744\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-744","post","type-post","status-publish","format-standard","hentry","category-try"],"_links":{"self":[{"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/posts\/744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/comments?post=744"}],"version-history":[{"count":12,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/posts\/744\/revisions"}],"predecessor-version":[{"id":3194,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/posts\/744\/revisions\/3194"}],"wp:attachment":[{"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/media?parent=744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/categories?post=744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soundengine.jp\/wordpress\/tips\/wp-json\/wp\/v2\/tags?post=744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}