rajesh daggumati
09:59 (4 hours ago)
to boost-users
HI,
please help me to solve below issue.
Shared pointers are used in my code.
class Exception : public virtual std::exception,public virtual
boost::exception
{
---
};
class ExceptionTestException : public Exception
{
---
};
boost::shared_ptr<Exception> exceptionptr_t;
try
{
Boost_Throw_function(ExceptionTestException("Hiii"));
}
catch(...)
{
boost::exception_ptr exceptionptr = boost::current_exception();
try
{
boost::rethrow(exceptionptr)
}
catch(boost::exception &e)
{
//here i need to assign this 'e' to shared pointer but this e is not in
heap so then how to assign this e to sharedptr(exceptionptr_t).
1 way is :
boost::exception *ep = new ExceptionTestException(e);
exceptionptr_t(ep);
here we know that exception_ptr is having ExceptionTestException but
in some cases, we dont know which type of excepiton we have in
exception_ptr in runtime.
then how to assign to shared_ptr