Propagating exceptions from destructors with std::exception_ptr
Permanent link:
cppdashboard.dev/r/2026/08/propagating-exceptions-from-destructors-with-std-exception-pA few weeks ago, I wrote about what happens when a destructor actually throws and why it is a dangerous idea. One of the readers commented that he was once in a situation where he had to propagate an exception from a destructor. But as a…
From the article
A few weeks ago, I wrote about what happens when a destructor actually throws and why it is a dangerous idea. One of the readers commented that he was once in a situation where he had to propagate an exception from a destructor. But as a destructor cannot safely throw and it also cannot return any value, he needed a better solution.
And that solution was std::exception_ptr .
Let’s look into what this type is and how it can be used.
Share this resource