我试图在跟踪How come I don't can't print out error from my throw exception?之后抛出异常,但它不会打印消息。它只打印terminate called after throwing an instance of 'char const*'
而不是test
以下是简短的代码段
try{
if(A.size().lines != B.size().lines || A.size().cols != B.size().lines){
throw std::runtime_error("test");
}
}
catch (std::exception const& exc)
{
std::cerr << exc.what() << "\n";
}