Hi Team,
PFB code snippet:
try
{
BOOST_THROW_EXCEPTION(std::invalid_argument("Blah"));
}
catch(...)
{
boost::exception_ptr exception = boost::current_exception();
const std::invalid_arguement* p;
try{ boost :: rethrow_exception(exceptionptr) }
catch(std::invalid_argument &e)
{
p = dynamic_cast(&e)
}
const std::invalid_argument* actualStdPtr =
ExceptionHelper::ExtractConstPtrstd::invalid_argument(exceptionptr);
EXPECT_TRUE(((void*)p) == ((void*)actualStdPtr)) << "Same
Object"; //this condition is getting failed.
}}
static const t* ExtractConstPtr(boost::exception_ptr ep)
{
try {
boost::rethrow_excepton(ep);
}
catch(T &e){
const T* exceptType = dynamic_cast(&e);
return exceptType;
}
catch (std::exception & e){
const T* exceptType = dynamic_cast(&e);
return exceptType;
}
}
//EXPECT_TRUE(((void*)p) == ((void*)actualStdPtr)) -->what will be the
reason to get failed as I do same thing in both cases.
Regards,
Rajesh D