Hi, All: I used a "shared_ptr<A> const&" to store a ref of A in B; Well, the constructor of B seems ok, the share_ptr<A> seems to be well initialized; but after the constructor, I found the the pointer silently become 0xCCCCCCCC
///////////////////////////////////// below are the simplified class definitions class A{}; class B { private: shared_ptr<A> const& m_ptr; public: B(shared_ptr<A> const& ptr):m_ptr(ptr) {cout<<m_ptr.get()<<endl;} void ShowPtr(cout<<m_ptr.get()<<endl;) } /////////////////////////////////// below are my exporting code class_<B, auto_ptr<B> >("B", init<shared_ptr<A> const&>()) .def("ShowPtr", &B::ShowPtr) ; class_<A, shared_ptr<A>, noncopyable >("A") ; /////////////////////////////////// below are python code a = A() b = B(a) #cout output the ptr of a b.ShowPtr() #cout output 0xCCCCCCCC ============================================ I'm quite confused by the behaviors here. Could you tell me what goes wrong? -- Time is mana, we must hurry
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig