If I define an exception class
class Exception : public std::runtime_error
{
/*...*/
private:
std::exception_ptr next;
std::exception_ptr prev;
}
in which I refer to pending exceptions by next
and new thrown exceptions while this
is pending by prev
, do the exception get freed after the exception is handled? The reason I'm asking is, that I once heard that std::exception_ptr
is implemented in terms of reference counting which can lead to memory leaks, if there are reference cicles as I produced in this class.