|
Boost : |
From: rajesh daggumati (rajeshdaggumati9999_at_[hidden])
Date: 2021-09-30 10:12:44
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<const std::invalid_argument*>(&e)
}
const std::invalid_argument* actualStdPtr =
ExceptionHelper::ExtractConstPtr<std::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<const T*>(&e);
return exceptType;
}
catch (std::exception & e){
const T* exceptType = dynamic_cast<const T*>(&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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk