16 Oct
2008
16 Oct
'08
10:53 p.m.
On Fri, Oct 17, 2008 at 12:42 AM, Peter Dimov
The problem is that the default constructor may be invoked after the first call to Register::global, overwriting _global and resetting it to empty. The first subsequent call to global() would now reinitialize it.
You can avoid this by making _global a local static:
static RegisterP global() { static RegisterP _global( new Register ); return _global; }
Yes! You're right :) I just tried with a debugger and is as you say. Thanks! -- ~Ale