为什么应该throw
是一个表达式而不是(非表达式)语句就像return
在第一个地方?我的意思是,是否有人想写些类似的东西auto x = throw std::runtime_error("Error message")
?
发布于 2018-04-28 14:13:36
如果throw
是一个声明,你不能在条件运算符中使用它。
return success()
? computation()
: throw std::runtime_error("oops");
https://stackoverflow.com/questions/-100004466
复制相似问题