Boost logo

Boost Users :

From: rajesh daggumati (rajeshdaggumati9999_at_[hidden])
Date: 2021-10-19 04:29:56


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-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net