From: klaas.holwerda <kho...@xs...> - 2005-11-25 20:38:40
|
John Labenski wrote: >On 11/25/05, klaas.holwerda <kho...@xs...> wrote: > > >>>It'll be a ref counted class so that it can be >>>passed around and >>> >>> >>> >>In case you need a smart pointer class, wxArt2D has one and is using it >>all over. >> >> > >We use a very simple smart pointer class for wxStrings and ints. see >wxLuaSmartStringArray >http://cvs.sourceforge.net/viewcvs.py/wxlua/wxLua/modules/wxlua/include/internal.h?rev=1.6&view=markup > >I don't think we need more, can you give me a link to yours? > > It is all in the next two files, a2dSmrtPtr http://cvs.sourceforge.net/viewcvs.py/wxart2d/wxArt2D/modules/general/include/smrtptr.h?rev=1.15&view=markup http://cvs.sourceforge.net/viewcvs.py/wxart2d/wxArt2D/modules/general/include/smrtptr.inl?rev=1.9&view=markup For lists we use STL -> a2dList -> a2dSmrtPtrList derived list. So a list of smart pointers. Easier in use then wxList when it comes to smart pointers. Our a2dObject is derived from wxObject and has the counter for the smart pointers. I love smart pointers. Especially in window close situations, and events, it easy to control when deletion will be done. And also easier during debugging. And with STL one almost has to use smart pointers else it will be impossible to store pointers, which will be deleted properly. That is why i choose to make wxArt2D, wxList free, so later it will be easy. The longer one waites, the worse it gets. How does wxLua deal with wxList? Regards, Klaas |