Boostを語れゴラァ part4at TECHBoostを語れゴラァ part4 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト23:デフォルトの名無しさん 07/04/12 20:32:36 > if( boost::shared_ptr<A> aa = wa.lock() ) { うへえ、キモい 24:デフォルトの名無しさん 07/04/12 21:05:05 そうか? 25:デフォルトの名無しさん 07/04/12 23:44:37 >>23 kwsk 26:デフォルトの名無しさん 07/04/13 00:37:03 aaの生存期間ってif文終了時点まで、であってるかな 27:デフォルトの名無しさん 07/04/13 01:08:14 // ericne, 27/nov/05: CW9_4 doesn't like if(shared_ptr x = y) shared_ptr<Derived> dep = cur2->lock(); if(dep.get()) { sout << "0x" << (void*)&*dep << ','; } 使うべきだが使えない。 いつものパターンです 28:デフォルトの名無しさん 07/04/13 01:47:29 int main() { boost::shared_ptr<A> a(new A(1)); boost::weak_ptr<A> wa(a); cout << "org: 0x" << (void*)a.get() << endl; // org: 0x0x00033480 cout << "in block" << endl; if( boost::shared_ptr<A> aa = wa.lock() ) { cout << "aa: 0x" << (void*)&*aa << endl; // aa: 0x0x00033480 aa.reset(new A(2)); cout << "reseted aa: 0x" << (void*)&*aa << endl; // reseted aa: 0x0x00037118 } cout << "out block" << endl; return 0; } 27氏がなにが言いたいのか分からない件について 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch