delete-operator
Can I delete an object owned by another with a callback from the object to be deleted?
I have one class (A) which knows when it should be deleted. I believe an object cannot directly delete itself (i.e., you can\'t call a destructor from inside it) so I\'ve used a callback.[详细]
2023-03-16 13:25 分类:问答Memory leak in delete loop
\"You have some memory leaks in the end due to a logical error in your deletion loop.\" My 开发者_StackOverflow社区friend said this and I don\'t see it.[详细]
2023-03-14 02:01 分类:问答Doesn't null check before delete/free optimize out the call to the function?
There are several questions regarding if to put null check before delete or not. Now, I have still seen such practices in many production code and I don\'t believe that all those programmers were unaw[详细]
2023-03-13 02:47 分类:问答delete'ing pointer of Type A pointing to pointer of type B
Suppose I have pointer of type ABC* and another pointer of type XYZ* and both derive from a common parent class.[详细]
2023-03-13 00:26 分类:问答How to detect double deletes or deletes on unallocated memory in C++?
I\'m writing a debug versions of global delete/new operator to detect memory leaks, double deletes and delete on unallocated memory.[详细]
2023-03-12 17:12 分类:问答Where exactly in memory is count of allocated memory thats being used by delete?
int* Array; Array = new int[10]; delete[] Array; The delete knows the count of allocated memory. I Googled that it 开发者_开发知识库stores it in memory, but it\'s compiler dependent. Is there anyw[详细]
2023-03-11 14:05 分类:问答If I delete a class, are its member variables automatically deleted?
I have been researching, and nothing relevant 开发者_StackOverflow中文版has come up, so I came here.[详细]
2023-03-10 15:00 分类:问答C++0x Function delete - Delete all but certain types
In C++0开发者_如何学Gox, I can do something like this: double f(double x) { return x; } template<class T>[详细]
2023-03-10 07:10 分类:问答What is the correct way to delete char**
I have a char**, basically an array of strings, that I need to delete. What is the correct way of doing this to ensure all pointer开发者_开发技巧s are cleared up?The rule of thumb is that you need one[详细]
2023-03-05 09:41 分类:问答Visual Studio 2010 C++ runtime error
I came across strange behavior in Visual Studio 2010 C++ compiler. Following code compiles but throws \"Debug assertion failed\" after execution with[详细]
2023-03-03 04:02 分类:问答