r/cpp • u/User_Deprecated • Jul 11 '26
Propagating exceptions from destructors with std::exception_ptr
https://www.sandordargo.com/blog/2026/07/08/exception_ptr
80
Upvotes
r/cpp • u/User_Deprecated • Jul 11 '26
View all comments
Show parent comment
26
u/SirClueless Jul 11 '26
It’s wishful thinking. Sometimes you have no other option. For example, a class that does buffered IO. You can provide a “flush()” method but what if the user fails to call it? You can either do a fallible write and maybe lose the data, or you can do nothing and definitely lose the data.