G++ and constructors
John Love-Jensen
eljay@adobe.com
Tue Mar 6 14:58:00 GMT 2007
Note:
I put in the init_instance() presuming you wanted to do some extra work in
there -- such as whatever lock() and unlock() are doing.
If you don't need to do any extra work, then you can collapse it to the
simpler:
----------------------------------------------------------------------
myclass* myclass::get_instance() // public: static
{
static myclass* instance = new myclass;
return instance;
}
----------------------------------------------------------------------
Sorry if I previous more complicated example caused confusion.
--Eljay
More information about the Gcc-help
mailing list