Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2021-09-22 18:09:34


rajesh daggumati wrote:
> Hi Team,
> in my code,I had to write like below:
> const int* p = boost::get_error_info<boost::throw_line>(exception);
> But while building the code,I am facing issue like below:
> error C2683: 'dynamic_cast':'boost::exception_ptr' is not a polymorphic type..

This implies that `exception` is of type `boost::exception_ptr`.

This is not an exception type, it's an opaque pointer that refers to an
exception. The only thing you can do with this pointer is tell it to rethrow
the exception it refers to. So:

try
{
    boost::rethrow_exception( exception );
}
catch( std::exception const& x )
{
    const int* p = boost::get_error_info<boost::throw_line>(x);
    // use p here
}


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