Re: [C++-sig] why does the "shared_ptr const&" silently become 0xCCCCCCCC

2009-03-13 Thread ZaeX
Oh, Thank god, so at least it is not only me. :) I just double-check this, and this behavior not only happened in debug build, it will happen in release build too, But the pointer showing up would not be 0x but something arbitrary. P.S.: I have already changed to follow you guys' advices

Re: [C++-sig] why does the "shared_ptr const&" silently become 0xCCCCCCCC

2009-03-12 Thread ZaeX
ass_, noncopyable >("A"); } from TryIt import * a = A() # Creating A b = B(a) # Creating B, 0xABCDE b.ShowPtr() # 0xABCDE On Fri, Mar 13, 2009 at 5:57 AM, David Abrahams wrote: > > on Thu Mar 12 2009, ZaeX wrote: > >

Re: [C++-sig] why does the "shared_ptr const&" silently become 0xCCCCCCCC

2009-03-12 Thread ZaeX
I just built the boost.python 1.36 with Python2.6.1 and tried again, and it still turned out to be 0x in debug build. And I made sure this is not caused by 'a = B(a)'-like typo. Maybe it's something concerning the project setting or something went wrong with my compiler(?) Whatever, I thin

Re: [C++-sig] why does the "shared_ptr const&" silently become 0xCCCCCCCC

2009-03-12 Thread ZaeX
Hi, I copied the code and tried again, and find out that this 0x problem would still occur at debug build, and when I switched to Release build, the 'b.ShowPtr()' gave a wrong address. But since this code is correct at your side, I think it's possibly because the precompiled boost.python

Re: [C++-sig] why does the "shared_ptr const&" silently become 0xCCCCCCCC

2009-03-12 Thread ZaeX
Thanks Roman, I think I will take the advice to try working around this problem. On Thu, Mar 12, 2009 at 1:17 PM, Roman Yakovenko wrote: > 2009/3/11 ZaeX : > > Hi,Roman: > > > > I have tried adding call policy on my constructor, but I'm really no good > at >

Re: [C++-sig] why does the "shared_ptr const&" silently become 0xCCCCCCCC

2009-03-11 Thread ZaeX
nnot modify the code back to use shared_ptr by value here, I have to break cyclic reference. And I think weak_ptr is no good idea, if I lock it 60 times per second for each object, I guess it would be an impact on performance. On Wed, Mar 11, 2009 at 2:19 PM, Roman Yakovenko wrote: > 2009/3/1

[C++-sig] why does the "shared_ptr const&" silently become 0xCCCCCCCC

2009-03-10 Thread ZaeX
Hi, All: I used a "shared_ptr const&" to store a ref of A in B; Well, the constructor of B seems ok, the share_ptr seems to be well initialized; but after the constructor, I found the the pointer silently become 0x / below are the simplified class defin

Re: [C++-sig] Call Policy for Singleton

2009-02-13 Thread ZaeX
When the Singleton class is linked, the DLL will get the Singleton::_instance as an unique static variable. Well, In my last attempt, it appeared to be like that. On Fri, Feb 13, 2009 at 5:33 PM, John Reid wrote: > ZaeX wrote: > >> And in my opinion, you'd better be careful i

Re: [C++-sig] Call Policy for Singleton

2009-02-12 Thread ZaeX
I think reference_existing_object will work. And in my opinion, you'd better be careful if you expect that the c++ code and python code are using the same singleton instance. Because there're two Singleton::_instance if you export the Singleton class to Python. one at c++ side, the other at python

Re: [C++-sig] ArgumentError when use the shared_ptr

2009-01-27 Thread ZaeX
Thanks, Roman. It solved the problem. Can't believe this '&' takes me two days. On Tue, Jan 27, 2009 at 4:26 PM, Roman Yakovenko wrote: > 2009/1/27 ZaeX : > > Hi, c++-sig: > > > > I got a problem involving shared_ptr here, > > according to some

[C++-sig] ArgumentError when use the shared_ptr

2009-01-26 Thread ZaeX
Hi, c++-sig: I got a problem involving shared_ptr here, according to some threads here I believed it should be solved by implicitly_convertible, however after many tries, I still cannot make it work. although this problem may look old, I really need your help or hint. My environment is WinXP + pyt

[C++-sig] ArgumentError when use the shared_ptr

2009-01-26 Thread ZaeX
Hi, c++-sig: I got a problem involving shared_ptr here, according to some threads here I believed it should be solved by implicitly_convertible, however after many tries, I still cannot make it work. although this problem may look old, I really need your help or hint. My environment is WinXP + pyt