Reputation: 69
try{ boost::rethrow(excep)}
catch(boost::exception &e)
{
} How to add this e to shared pointer.This e is not in heap area .
Upvotes: 1
Views: 133
Reputation: 393537
Indeed exception pointers are special: https://www.boost.org/doc/libs/1_63_0/libs/exception/doc/exception_ptr.html (just like the corresponding [std::exception_ptr
][1])
There's no probem wrapping a copy of the exception but
allocate_shared
)That mechanism has been adopted into C++ with http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html
In short I strongly think you're looking for boost::exception_ptr
or std::exception_ptr
with current_exception()
.
[1]: https://en.cppreference.com/w/cpp/error/exception_ptr
Upvotes: 1