Boost logo

Boost :

From: rajesh daggumati (rajeshdaggumati9999_at_[hidden])
Date: 2021-10-19 09:28:27


rajesh daggumati <rajeshdaggumati9999_at_[hidden]>
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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk