Top "Delete-operator" questions

In the C++ programming language, the delete operator calls the destructor of the given argument, and returns memory allocated by new back to the heap.

How does the custom deleter of std::unique_ptr work?

According to N3290, std::unique_ptr accepts a deleter argument in its constructor. However, I can't get that to work …

c++ c++11 unique-ptr delete-operator
Delete a pointer to pointer (as array of arrays)

I have this in my code: double** desc = new double* [size_out]; for (int i = 0; i < size_out; i++) …

c++ pointers delete-operator
Is there any reason to check for a NULL pointer before deleting?

I often see legacy code checking for NULL before deleting a pointer, similar to, if (NULL != pSomeObject) { delete pSomeObject; pSomeObject = …

c++ pointers null delete-operator
If I delete a class, are its member variables automatically deleted?

I have been researching, and nothing relevant has come up, so I came here. I am trying to avoid memory …

c++ class variables member delete-operator
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); …

c++ segmentation-fault delete-operator
The difference between delete and delete[] in C++

Possible Duplicate: delete vs delete[] operators in C++ I've written a class that contains two pointers, one is char* color_ …

c++ memory-management delete-operator
Behaviour of malloc with delete in C++

int *p=(int * )malloc(sizeof(int)); delete p; When we allocate memory using malloc then we should release it using …

c++ malloc delete-operator
Deleting a pointer to const (T const*)

I have a basic question regarding the const pointers. I am not allowed to call any non-const member functions using …

c++ constants 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 …

c++ pointers object memory delete-operator
Deleting array of pointers

Does delete[] a, where a is dynamic-allocated array of pointers, execute delete for each pointer in array? I suppose, it …

c++ arrays pointers delete-operator