Is “delete this” allowed in C++?

Is it allowed to delete this; if the delete-statement is the last statement that will be executed on that instance of the class? Of course I’m sure that the object represented by the this-pointer is newly-created. I’m thinking about something like this: void SomeModule::doStuff() { // in the controller, “this” object of SomeModule is the … Read more

Deleting array elements in JavaScript – delete vs splice

What is the difference between using the delete operator on the array element as opposed to using the Array.splice method? For example: myArray = [‘a’, ‘b’, ‘c’, ‘d’]; delete myArray[1]; // or myArray.splice (1, 1); Why even have the splice method if I can delete array elements like I can with objects? 2 27 delete … Read more