tag:blogger.com,1999:blog-11395554.post443180850204121748..comments2023-04-03T22:01:02.122+08:00Comments on Lambda Mind: 出錯yen3http://www.blogger.com/profile/09160610856837426907noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-11395554.post-39558428400990869902009-06-03T15:20:38.321+08:002009-06-03T15:20:38.321+08:00@ fr3@K: 謝謝你的建議,寫在內容哩 !@ fr3@K: 謝謝你的建議,寫在內容哩 !yen3https://www.blogger.com/profile/09160610856837426907noreply@blogger.comtag:blogger.com,1999:blog-11395554.post-90863400150334142522009-06-03T14:50:32.133+08:002009-06-03T14:50:32.133+08:00enable_shared_from_this<a href="http://www.boost.org/doc/libs/1_39_0/libs/smart_ptr/enable_shared_from_this.html" rel="nofollow">enable_shared_from_this</a>fr3@Khttps://www.blogger.com/profile/08991591010748622228noreply@blogger.comtag:blogger.com,1999:blog-11395554.post-6070417066884956492009-06-03T14:02:17.969+08:002009-06-03T14:02:17.969+08:00是啊,所以要想辦法讓這兩個使用相同的 reference count XD是啊,所以要想辦法讓這兩個使用相同的 reference count XDyen3https://www.blogger.com/profile/09160610856837426907noreply@blogger.comtag:blogger.com,1999:blog-11395554.post-39473461073876838962009-06-03T13:23:45.027+08:002009-06-03T13:23:45.027+08:00不知道有沒有錯 目測debug
printTestA(boost::shared_ptr<...不知道有沒有錯 目測debug<br /><br />printTestA(boost::shared_ptr<TestA>(this));<br /><br />boost smart pointer應該是reference-count based<br />你這樣會產生一個臨時的shared_ptr<br />然後解構, reference count=0, delete原本的raw pointer<br />然後原本那個smart pointer就掛了Mr. BigCathttps://www.blogger.com/profile/03316886314546031469noreply@blogger.com