Originally posted by Nick
http://users.utu.fi/sisasa/oasis/cpp...ore-mgmt.html#[16.14]

I cannot think of any *properly* designed data structures
where you would delete this. For a linked list you might
have the nodes delete them selfs recursivly. That's really
ugly.
So how do you do a linked list then, without some external node handling functions? I used to have an extra object as a first node, and always looking one step ahead (meaning that the data in node 2 was actually the data for node 1), but that is kinda ugly from a programming perspective.

[16.14] Is it legal (and moral) for a member function to say delete this?

As long as you're careful, it's OK for an object to commit suicide (delete this).

Here's how I define "careful":

1.You must be absolutely 100% positive sure that this object was allocated via new (not by new[], nor by placement new, nor a local object on the stack, nor a global, nor a member of
another object; but by plain ordinary new).
2.You must be absolutely 100% positive sure that your member function will be the last member function invoked on this object.
3.You must be absolutely 100% positive sure that the rest of your member function (after the delete this line) doesn't touch any piece of this object (including calling any other
member functions or touching any data members).
4.You must be absolutely 100% positive sure that no one even touches the this pointer itself after the delete this line. In other words, you must not examine it, compare it with another
pointer, compare it with NULL, print it, cast it, do anything with it.

Naturally the usual caveats apply in cases where your this pointer is a pointer to a base class when you don't have a virtual destructor.
Most of these seems to fit my approach, but can someone explain 2). Does it mean I can't call any other methods (which is kinda obvious)? But isn't that what 3) says?