Le 08/05/2015 23:10, Georg Baum a écrit :
I have many places like in the patch below. Is there a reason why I
should keep the auto_ptr instead of a naked pointer? What is it good for?

Usually it is used for exception safety: If you use a raw pointer, you need
to delete it in the catch clause, else you get a memory leak. This would be
easy to do in this particular example, but impossible if the catch happens
somewhere completely different.

OK, I read some FAQs now. The issue is not the memory of the object itself, but the fact the the destructor is not tun, which means that the memory it may have allocated (string, ...) is not released.

So we need yet another special header, as I see it.

JMarc

Reply via email to