I use CArrayObj extensively, very often I mix dynamically created objects and automatic created objects, CArrayObj delete the content without checking the pointer type. To avoid this, I have to turn off freemode at the expense of creating a lot of messy codes just to keep track of the dynamic pointers to delete them properly.
I am currently extending the 2 classes with my own pointer check so that all my other programmes can safely use CArrayObj without concerning about the pointer deletion.
I suggest a feature to check the pointer before delete it in CArrayObj and CList.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I use CArrayObj extensively, very often I mix dynamically created objects and automatic created objects, CArrayObj delete the content without checking the pointer type. To avoid this, I have to turn off freemode at the expense of creating a lot of messy codes just to keep track of the dynamic pointers to delete them properly.
I am currently extending the 2 classes with my own pointer check so that all my other programmes can safely use CArrayObj without concerning about the pointer deletion.
I suggest a feature to check the pointer before delete it in CArrayObj and CList.
if (CheckPointer(ptr)==POINTER_DYNAMIC) delete ptr;