delete-operator
How to delete an object in a set
In my C++ program, I create objects in one function using new. These objects are inserted into a set. When I want to remove objects from the set, I use an iterator in a for-loop. When I remove the obj[详细]
2023-03-01 12:02 分类:问答Will delete[] with void* cause memory leak? [duplicate]
This question already has answers here: Closed 11 years ago. Possible Duplicate: Is it safe to delete a void pointer?[详细]
2023-03-01 02:50 分类:问答How to free memory of dynamic struct array
As someone who never 开发者_如何学编程dealt with freeing memory and so on, I got the task to create a dynamic array of struct and create functions to add or delete array elements. When deleting I have[详细]
2023-02-28 06:00 分类:问答Delete an array of queue objects
I am working on an object that contains an array of queues with an array length that isn\'t decided until the constructor is called. Basically it looks some开发者_如何学Cthing like the following[详细]
2023-02-18 18:10 分类:问答What can cause a segmentation fault using delete command in C++?
I\'ve written a program that allocates a new object of the class T like this: T* obj = new T(tid); where tid is an int[详细]
2023-02-18 05:45 分类:问答new or new[] operator
Consider following code: typedefSomeType type_t[2]; SomeType * arr1 = new type_t; //new or new[] ??? type_t * arr2 = new type_t[3]; //new or new[] ???[详细]
2023-02-18 03:48 分类:问答Segmentation fault during processing delete command
I have a program that using a vector (called _library) that holds objects of the class \'thread\' that I\'ve created (holds a set of data, and allocating some stuff in its Constructor).[详细]
2023-02-17 17:46 分类:问答"delete this" in constructor
What开发者_如何学运维 actually happen when I execute this code? class MyClass { MyClass() { //do something[详细]
2023-02-17 06:12 分类:问答Double free errors when using shallow copies of objects... how to fix?
How do I remove double (delete) errors from shallow copied object vs original object. A simple example:[详细]
2023-02-16 07:45 分类:问答How can we call "delete this; " in a const-member function?
I saw the code snippet as follows: class UPNumber { public: UPNumber(); UPNumber(int initValue); ... // ps开发者_StackOverflow中文版eudo-destructor (a const member function, because[详细]
2023-02-13 20:07 分类:问答