Why intrusive_ptr destructor can throw exceptions?

Hello! I found another difference between shared_ptr and intrusive_ptr behavior: * shared_ptr destructor never throw exceptions; * intrusive_ptr destructor can throw exceptions. In my opinion, ~intrusive_ptr() should not throw exceptions too, because current behavior is much complicated and fraught with memory leak bugs.

Pavel Syomin wrote:
Hello!
I found another difference between shared_ptr and intrusive_ptr behavior:
* shared_ptr destructor never throw exceptions; * intrusive_ptr destructor can throw exceptions.
In my opinion, ~intrusive_ptr() should not throw exceptions too, because current behavior is much complicated and fraught with memory leak bugs.
~intrusive_ptr never throws any exceptions on its own; if intrusive_ptr_release doesn't throw, neither will the destructor.
participants (2)
-
Pavel Syomin
-
Peter Dimov